CXF调用天气预报出错

21 views
Skip to first unread message

9719...@qq.com

unread,
Sep 20, 2011, 3:14:08 AM9/20/11
to cxf-zh
public class Test{
private static final QName SERVICE_NAME
= new QName("http://WebXml.com.cn/", "WeatherWebServiceSoap");
private static final QName PORT_NAME
= new QName("http://WebXml.com.cn/",
"WeatherWebServiceSoapPort");

private Test() {
}

public static void main(String args[]) throws Exception {

Service service = Service.create(SERVICE_NAME);
String endpointAddress = "http://www.webxml.com.cn/WebServices/
WeatherWebService.asmx?wsdl";
service.addPort(PORT_NAME, SOAPBinding.SOAP12HTTP_BINDING,
endpointAddress);
UserService hw = service.getPort(UserService.class);
// System.out.println(hw.getDatabaseInfo());
System.out.println(hw.getWeatherbyCityName("北京"));

}
异常信息:

警告: Interceptor for {http://WebXml.com.cn/}
WeatherWebServiceSoap#{http://webxml.com.cn/}getWeatherbyCityName has
thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:
48)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:
263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:
88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:
134)
at $Proxy31.getWeatherbyCityName(Unknown Source)
at cn.com.webxml.ffffffff.main(ffffffff.java:45)
Caused by: java.net.MalformedURLException: Invalid address. Endpoint
address cannot be null.
at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:
735)
at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:
719)
at
org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPConduit.java:
666)
at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:
459)
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:
46)
... 9 more
Exception in thread "main" javax.xml.ws.WebServiceException: Could not
send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:
145)
at $Proxy31.getWeatherbyCityName(Unknown Source)
at cn.com.webxml.ffffffff.main(ffffffff.java:45)
Caused by: java.net.MalformedURLException: Invalid address. Endpoint
address cannot be null.
at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:
735)
at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:
719)
at
org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPConduit.java:
666)
at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:
459)
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:
46)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:
263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:
88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:
134)
... 2 more











Reply all
Reply to author
Forward
0 new messages