[解决]电信彩信网关开发错误-SOAP_VERSIONMISMATCH
? ? <text>SOAP_VERSIONMISMATCH</text>?
?已經(jīng)解決,主要是查看了網(wǎng)上的一個同學的帖子,非常感謝。
? 再來看一下請求信息?
1?????POST?/MmsSendMessageService?HTTP/1.1??2?????Content-Type:?multipart/related;?boundary="==part20111027095621==";?type="text/xml";?start="<SOAP-ENV:Envelope>"??
3?????SOAPAction:?""??
4?????Host:?118.85.200.55:9081??
5?????Content-Length:?49878??
6?????Expect:?100-continue????
?
這個是HttpWebRequest ?請求的頭。這兩個東西很重要。
Content-Type:?multipart/related;?boundary="==part20111027095621==";?type="text/xml";?start="<SOAP-ENV:Envelope>"??
SOAPAction:?"" ? ? ? ?電信文檔里有提到,SOAPAction用空值。?
需要添加到頭中去。
?
1?????HttpWebRequest?myRequest?=?(HttpWebRequest)WebRequest.Create(請求的地址); ??2?????myRequest.ContentType?=?"multipart/related;?boundary=\"==part20111027095621==\";?type=\"text/xml\";?start=\"<SOAP-ENV:Envelope>\"";??
3?????myRequest.Headers.Add("SOAPAction:?\"\"");?
?
?接下來就是拼接彩信包了。[求救]電信彩信網(wǎng)關(guān)開發(fā)錯誤-SOAP_VERSIONMISMATCH?文章中的包還是有點小問題,下面看這個成功測試過的包。
?1?POST?/MmsSendMessageService?HTTP/1.1?2?Host:118.85.200.55:9081
?3?User-Agent:?WU
?4?Content-Type:?multipart/related;??boundary="==part20120120111818==";?type="text/xml";?start="<BB724A5ADD3D2A96CA5E4697BAD1F3A8>"
?5?Content-Length:1803
?6?SOAPAction:?""
?7?
?8?--==part20120120111818==
?9?Content-Type:?text/xml;?charset=UTF-8
10?Content-Transfer-Encoding:?binary
11?Content-ID:?<BB724A5ADD3D2A96CA5E4697BAD1F3A8>
12?
13?<?xml?version="1.0"?encoding="UTF-8"?>
14?<SOAP-ENV:Envelope?xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"?xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"?xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?xmlns:xsd="http://www.w3.org/2001/XMLSchema"?xmlns:ns3="http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1"?xmlns:ns1="http://www.chinatelecom.com.cn/schema/ctcc/multimedia_messaging/send/v2_2/local">
15?<SOAP-ENV:Header>
16?<ns3:RequestSOAPHeader>
17?<spId>35101051</spId>
18?<spPassword>E6E19093A2691F495D27332B9F1584F8</spPassword>
19?<timeStamp>0120111818</timeStamp>
20?<productId>135000000000000166819</productId>
21?<SAN></SAN>
22?<transactionId></transactionId>
23?<transEnd>0</transEnd>
24?<linkId>01130545065586044505</linkId>
25?<OA>tel:18925280633</OA>
26?<FA></FA>
27?<multicastMessaging>false</multicastMessaging>
28?</ns3:RequestSOAPHeader>
29?</SOAP-ENV:Header>
30?<SOAP-ENV:Body>
31?<ns1:sendMessage>
32?<ns1:addresses>tel:18925280633</ns1:addresses>
33?<ns1:senderAddress>10660502</ns1:senderAddress>
34?<ns1:subject>生活幫</ns1:subject>
35?<ns1:priority>Default</ns1:priority>
36?<ns1:charging>
37?<description></description>
38?<currency></currency>
39?<amount>100</amount>
40?<code>shb</code>
41?</ns1:charging>
42?<ns1:receiptRequest>
43?<endpoint>tel:18925280633</endpoint>
44?<interfaceName>sendMessage</interfaceName>
45?<correlator>201201130605570433620518925280633</correlator>
46?</ns1:receiptRequest>
47?</ns1:sendMessage>
48?</SOAP-ENV:Body>
49?</SOAP-ENV:Envelope>
50?--==part20120120111818==
51?Content-Type:?text/plain;?charset=UTF-8
52?Content-Transfer-Encoding:?binary
53?Content-ID:?<1.txt>
54?Content-Location:?1.txt
55?
56?yyadsf
57?
58?--==part20120120111818==--
這里要說的是幾個特別需要注意的地方。
根據(jù)包格式組包成功后,和電信對接測試。
一直不能成功。通過抓包發(fā)現(xiàn)錯誤提示是
<faultstring>500 Internal Server Error</faultstring>
具體錯誤是:
1?????<messageId>SVC0001</messageId>??2?????<text>SOAP_VERSIONMISMATCH</text>??
??繼續(xù)和電信提供的包格式核對,確定包體和附件都沒問題。
錯誤的內(nèi)容是SOAP版本不正確,我就想難道是電信的和我用的SOAP版本不想符合,于是我就繼續(xù)查找SOAP相關(guān)的知識。看到一個很有用的帖子,地址不記得了(找到在發(fā)布上來)。帖子中說道帶附件的SOAP包格式。包體之間需要用換行符號隔開。1?????--==part20111027095621==這里有個\r\n2?????Content-Type:?text/xml;?charset=UTF-8??這里有個\r\n
3?????Content-Transfer-Encoding:?binary??這里有個\r\n
4?????Content-ID:?<SOAP-ENV:Envelope>??這里有個\r\n?還需要在來一個\r\n空一行
5???????
6?????<?xml?version="1.0"?encoding="UTF-8"??>???
根據(jù)包格式組包成功后,和電信對接測試,一直不能成功。
包體和附件,附件中協(xié)議和附件體具體格式請參照上面成功的包。
這個換行一定要注意,不然post就不能成功。
返回的數(shù)據(jù)格式為:
<?xml?version="1.0"?encoding="UTF-8"?><SOAP-ENV:Envelope?xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"?xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"?xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?xmlns:xsd="http://www.w3.org/2001/XMLSchema"?xmlns:comm3="http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1"?xmlns:mm1="http://www.chinatelecom.com.cn/schema/ctcc/multimedia_messaging/send/v2_2/local">
????<SOAP-ENV:Header>
????????<comm3:NotifySOAPHeader>
????????????<spRevId>szsxd</spRevId>
????????????<spRevpassword>123542</spRevpassword>
????????????<spId>35101051</spId>
????????????<linkId>01130545065586044505</linkId>
????????</comm3:NotifySOAPHeader>
????</SOAP-ENV:Header>
????<SOAP-ENV:Body>
????????<mm1:sendMessageResponse>
????????????<mm1:result>19350101400120111824000490H</mm1:result>
????????</mm1:sendMessageResponse>
????</SOAP-ENV:Body>
</SOAP-ENV:Envelope>??
程序處理Ok,再此還要感謝Google的搜索,和那位大哥的換行指導(dǎo)。
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/wenanry/archive/2012/01/20/2327945.html
總結(jié)
以上是生活随笔為你收集整理的[解决]电信彩信网关开发错误-SOAP_VERSIONMISMATCH的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java多线程总结一:线程的两种创建方式
- 下一篇: 得到python默认的帮助文档