錯誤消息:
<?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.csdn.net/wxyong3/article/details/38727503
https://blog.csdn.net/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