cxf生成客户端代码成功,使用抛出异常

今天用cxf生成客户端代码,通过wsdl获取天气预报

wsdl:http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl

参照博客http://a.qt.hk/v/Csdnblog/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcG9zb25yaWNrL2FydGljbGUvZGV0YWlscy80NTU3NDY2Mw==

一直报错,折腾了好久

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: No namespace on "html" element. You must send a SOAP request.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
at com.sun.proxy.$Proxy32.getWeather(Unknown Source)
at com.devins.ws.weather.WeatherQueryTest.main(WeatherQueryTest.java:18)
Caused by: org.apache.cxf.binding.soap.SoapFault: No namespace on "html" element. You must send a SOAP request.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.readVersion(ReadHeadersInterceptor.java:109)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:142)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1679)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1517)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1425)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:650)

注意,此客户端工程调用无需引入cxf的相关jar包,引入执行上面的测试代码会报如上错误: