java中的Soap版本不匹配
Soap请求生成的Java应用程序[失败]java中的Soap版本不匹配,java,soap,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> </soape
<?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>
<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>
SoapUI生成的Soap请求[成功]
<?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>
<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“”更改为“”。我没有创建任何客户机,我只是创建了java类并运行,因为上面的uri链接,我能够发送请求并获得faultcode响应。我发现这是版本不匹配,但我不知道如何更改。我觉得您必须使用问题中提供的默认SOAP实现(即SOAP 1.2)。您的web服务可能需要SOAP 1.1 如果您可以更改它的实现,它应该可以解决您的问题。您的命名空间将更改为
xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/“
将callSoapWebService
methodfirst行更改为following,它应该可以解决问题
SOAPMessage SOAPMessage=SOAPMessageFactory1\u 1Impl.newInstance().createMessage()代码>
希望有帮助。MessageFactory=MessageFactory.newInstance()----它将给出1.1版本的默认值
更改为以下内容以获取soap命名空间的1.2版本
MessageFactory工厂=
newInstance(SOAPConstants.SOAP\u 1\u 2\u协议)强>
您可以在SAAJ教程中找到它添加java soap客户端代码片段,如果没有它,很难回答。我在这个链接中的答案中使用了相同的代码……在这两者之间进行切换,对我来说效果很好!