错误消息:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
<detail>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">host1</ns2:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
解决方法,
//HttpURLConnection连接,需设置 SOAPAction Header :
connect.setRequestProperty("SOAPAction","");//参数2可以是任意字符串,我写的url
//SOAPAction正确值,应该查看:url.wsdl 的:<soap:operation soapAction="..." />
参考:
https://blog.youkuaiyun.com/wxyong3/article/details/38727503
https://blog.youkuaiyun.com/etttttss/article/details/21624313
推荐:根据结果搜索,健全的http调用webservice接口方法,写的比较清晰
https://www.cnblogs.com/eleven258/p/7157419.html?utm_source=itdadao&utm_medium=referral
SOAP和WSDL对Web Service、WCF进行深入了解的基础
https://www.cnblogs.com/JeffreySun/archive/2009/12/14/1623766.html