服务器未能识别 HTTP 头 SOAPAction 的值错误,跪求求大神解决一下
小弟刚学webservice 跪求大神指导。错误信息:服务器未能识别 HTTP 头 SOAPAction 的值: http://www.webxml.com.cn/WebServices/WeatherWebService.asmx/getSupportCity。
贴出源码如下:
String endpoint = "http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl";
String targetNamespace = "http://www.webxml.com.cn/WebServices/WeatherWebService.asmx";
String method="getSupportCity";
// 创建一个服务(service)调用(call)
Service service = new Service();
Call call = (Call) service.createCall();// 通过service创建call对象
// 设置service所在URL
call.setTargetEndpointAddress(new URL(endpoint));
call.setOperationName(new QName(method));
call.setUseSOAPAction(true);
call.addParameter(new QName("byProvinceName"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的参数
//call.setReturnClass(org.w3c.dom.Element.class);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
String path = targetNamespace +"/"+ method;
call.setSOAPActionURI(path);
Object ret = call.invoke(new Object[] {"ALL"});
System.out.println("xx==="+ret.toString());