+ -
当前位置:首页 → 问答吧 → 发送soap报文得到soap:VersionMismatch的错误

发送soap报文得到soap:VersionMismatch的错误

时间:2010-09-14

来源:互联网

我是用httpClient这个发送的soap报文,
用method.setRequestBody(s);这个方法去设置它post的内容,client.executeMethod(method);去执行。
其中s的内容是发送的soap报文 格式如下:
<?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>
<ns1:callWebService soapenv:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1=" http://webservice.bsn.ztesoft.com">
<requMessage href="#id0"/>
</ns1:callWebService>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:RequMessage" xmlns:soapenc=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2=" http://model.webservice.bsn.ztesoft.com">
<srvModule xsi:type="xsd:string">BillItemCQSrv</srvModule><passwd xsi:type="xsd:string"/><srvFunction xsi:type="xsd:string">queryCustList</srvFunction><content xsi:type="xsd:string">&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;BillItemCQReq&gt;&lt;AccNbr&gt;18983080008&lt;/AccNbr&gt;&lt;NbrType&gt;1&lt;/NbrType&gt;&lt;DisPlayType&gt;1&lt;/DisPlayType&gt;&lt;BillingMonth&gt;201004&lt;/BillingMonth&gt;&lt;PageNo&gt;1&lt;/PageNo&gt;&lt;PageSize&gt;2&lt;/PageSize&gt;&lt;/BillItemCQReq&gt;</content><connectId xsi:type="xsd:string">68409706</connectId>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
以下是得到的错误的报文:
<?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:Header>
<soapenv:Upgrade soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
<soapenv:SupportedEnvelope qname="soapenv:Envelope"/>
</soapenv:Upgrade>
</soapenv:Header>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:VersionMismatch</faultcode>
<faultstring>Version Mismatch</faultstring>
<detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">jfapp1_perm</ns1:hostname></detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
网上说是soap1.1和soap1.2的冲突,我也按网上提供的方法做了,但是还没有解决。

作者: zzd6436643   发布时间: 2010-09-14

你发送的SOAP 1.1的版本,但服务器可能要求的是1.2,所以版本不匹配。
你用SOAP1.2的格式进行封装就没问题了。格式你可以参考这里:http://wenku.baidu.com/view/41034b35eefdc8d376ee3223.html
基本能满足,但这里不是最新的。如果想用最新的格式,可以阅读这里的规范http://www.w3.org/TR/2007/REC-soap12-part1-20070427/#soapenv

至于你说按网上的方法做了,我不知道你做了什么,至少从你贴出来的,仍没体现出你的SOAP包有什么变化。

作者: cds27   发布时间: 2010-09-15