<text>SOAP_VERSIONMISMATCH</text>
已经解决,主要是查看了网上的一个同学的帖子,非常感谢。
再来看一下请求信息
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用空值。
需要添加到头中去。
2 myRequest.ContentType = "multipart/related; boundary=\"==part20111027095621==\"; type=\"text/xml\"; start=\"<SOAP-ENV:Envelope>\"";
3 myRequest.Headers.Add("SOAPAction: \"\"");
接下来就是拼接彩信包了。[求救]电信彩信网关开发错误-SOAP_VERSIONMISMATCH 文章中的包还是有点小问题,下面看这个成功测试过的包。
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==--
这里要说的是几个特别需要注意的地方。
根据包格式组包成功后,和电信对接测试。
一直不能成功。通过抓包发现错误提示是
<faultstring>500 Internal Server Error</faultstring>
具体错误是:
2 <text>SOAP_VERSIONMISMATCH</text>
继续和电信提供的包格式核对,确定包体和附件都没问题。
2 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" ?>
根据包格式组包成功后,和电信对接测试,一直不能成功。
包体和附件,附件中协议和附件体具体格式请参照上面成功的包。
这个换行一定要注意,不然post就不能成功。
返回的数据格式为:
<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的搜索,和那位大哥的换行指导。