java中的Soap版本不匹配
Soap请求生成的Java应用程序[失败]
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dir="http://xxxxxxxxxx">
<soapenv:Body>
<xxxxxxxxxxx>
</soapenv:Body>
</soapenv:Envelope>
SoapUI生成的Soap请求[成功]
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:dir="http://xxxxxxxxxx">
<soap:Header/>
<soap:Body>
<dir:ping/>
</soap:Body>
</soap:Envelope>
如何将命名空间uri“http://schemas.xmlsoap.org/soap/envelope/”更改为“http://www.w3.org/2003/05/soap-envelope”。我还没有创建任何客户端,我只是创建了java类并运行,因为上面的uri链接,我能够发送请求并获得faultcode响应。我发现这是版本不匹配,但我不知道如何更改
# 1 楼答案
我觉得您必须使用Statckoverflow问题中提供的默认SOAP实现(即SOAP 1.2)。您的web服务可能需要SOAP 1.1
如果你能改变它
SOAPMessageFactory1_1Impl
的实现,它应该能解决你的问题。您的命名空间将更改为xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
将
callSoapWebService
方法第一行更改为下面的,它应该可以解决这个问题SOAPMessage soapMessage = SOAPMessageFactory1_1Impl.newInstance().createMessage();
希望能有帮助