java javax.xml.ws.WebServiceException: 不是一个有效的端口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13530484/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
javax.xml.ws.WebServiceException: is not a valid port
提问by Carlos Garces
I'm tring to made a dinamic WS call using jax-ws.
我正在尝试使用 jax-ws 进行动态 WS 调用。
But I can't create the dispatcher, the code is:
但是我不能创建调度程序,代码是:
String namespace= "http://wsf.cdyne.com/WeatherWS/Weather.asmx";
try {
QName serviceName = new QName(namespace, "GetCityForecastByZIP");
Service s = Service.create(serviceName);
QName portName = new QName(namespace, "WeatherSoap12");
Dispatch<DOMSource> dispatch = s.createDispatch(portName,
DOMSource.class,
Service.Mode.PAYLOAD);
...
The error is javax.xml.ws.WebServiceException: {http://wsf.cdyne.com/WeatherWS/Weather.asmx}WeatherSoap12 is not a valid port. Valid ports are:
错误是 javax.xml.ws.WebServiceException: {http://wsf.cdyne.com/WeatherWS/Weather.asmx}WeatherSoap12 不是有效端口。有效端口为:
I have ckect the WSDL at http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDLand I can't identify the reason of the error.
我在http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL 上检查了 WSDL,但我无法确定错误的原因。
Any help?
有什么帮助吗?
采纳答案by Carlos Garces
SOLVED. The sample code used was incomplete, I need to add the port to the server
解决了。使用的示例代码不完整,我需要将端口添加到服务器
s.addPort(portName, SOAPBinding.SOAP12HTTP_BINDING, WSDL_ENDPOINT_URL);