找个为公司做网站的,在线建设网站制作,小程序需不需要服务器,平台创建上一个文章#xff1a;[求救]电信彩信网关开发错误#xff0d;SOAP_VERSIONMISMATCH 说的问题messageIdSVC0001/messageId textSOAP_VERSIONMISMATCH/text 已经解决#xff0c;主要是查看了网上的一个同学的帖子#xff0c;非常感谢。再来…上一个文章[求救]电信彩信网关开发错误SOAP_VERSIONMISMATCH 说的问题messageIdSVC0001/messageId textSOAP_VERSIONMISMATCH/text 已经解决主要是查看了网上的一个同学的帖子非常感谢。 再来看一下请求信息 1 POST /MmsSendMessageService HTTP/1.1 2 Content-Type: multipart/related; boundarypart20111027095621; typetext/xml; startSOAP-ENV:Envelope 3 SOAPAction: 4 Host: 118.85.200.55:9081 5 Content-Length: 49878 6 Expect: 100-continue 这个是HttpWebRequest 请求的头。这两个东西很重要。 Content-Type: multipart/related; boundarypart20111027095621; typetext/xml; startSOAP-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: \\); 接下来就是拼接彩信包了。[求救]电信彩信网关开发错误SOAP_VERSIONMISMATCH 文章中的包还是有点小问题下面看这个成功测试过的包。 1 POST /MmsSendMessageService HTTP/1.1 2 Host:118.85.200.55:9081 3 User-Agent: WU 4 Content-Type: multipart/related; boundarypart20120120111818; typetext/xml; startBB724A5ADD3D2A96CA5E4697BAD1F3A8 5 Content-Length:1803 6 SOAPAction: 7 8 --part20120120111818 9 Content-Type: text/xml; charsetUTF-810 Content-Transfer-Encoding: binary11 Content-ID: BB724A5ADD3D2A96CA5E4697BAD1F3A812 13 ?xml version1.0 encodingUTF-8?14 SOAP-ENV:Envelope xmlns:SOAP-ENVhttp://schemas.xmlsoap.org/soap/envelope/ xmlns:SOAP-ENChttp://schemas.xmlsoap.org/soap/encoding/ xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:xsdhttp://www.w3.org/2001/XMLSchema xmlns:ns3http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1 xmlns:ns1http://www.chinatelecom.com.cn/schema/ctcc/multimedia_messaging/send/v2_2/local15 SOAP-ENV:Header16 ns3:RequestSOAPHeader17 spId35101051/spId18 spPasswordE6E19093A2691F495D27332B9F1584F8/spPassword19 timeStamp0120111818/timeStamp20 productId135000000000000166819/productId21 SAN/SAN22 transactionId/transactionId23 transEnd0/transEnd24 linkId01130545065586044505/linkId25 OAtel:18925280633/OA26 FA/FA27 multicastMessagingfalse/multicastMessaging28 /ns3:RequestSOAPHeader29 /SOAP-ENV:Header30 SOAP-ENV:Body31 ns1:sendMessage32 ns1:addressestel:18925280633/ns1:addresses33 ns1:senderAddress10660502/ns1:senderAddress34 ns1:subject生活帮/ns1:subject35 ns1:priorityDefault/ns1:priority36 ns1:charging37 description/description38 currency/currency39 amount100/amount40 codeshb/code41 /ns1:charging42 ns1:receiptRequest43 endpointtel:18925280633/endpoint44 interfaceNamesendMessage/interfaceName45 correlator201201130605570433620518925280633/correlator46 /ns1:receiptRequest47 /ns1:sendMessage48 /SOAP-ENV:Body49 /SOAP-ENV:Envelope50 --part2012012011181851 Content-Type: text/plain; charsetUTF-852 Content-Transfer-Encoding: binary53 Content-ID: 1.txt54 Content-Location: 1.txt55 56 yyadsf57 58 --part20120120111818-- 这里要说的是几个特别需要注意的地方。 根据包格式组包成功后和电信对接测试。 一直不能成功。通过抓包发现错误提示是 faultstring500 Internal Server Error/faultstring 具体错误是1 messageIdSVC0001/messageId 2 textSOAP_VERSIONMISMATCH/text 继续和电信提供的包格式核对确定包体和附件都没问题。错误的内容是SOAP版本不正确我就想难道是电信的和我用的SOAP版本不想符合于是我就继续查找SOAP相关的知识。看到一个很有用的帖子地址不记得了找到在发布上来。帖子中说道带附件的SOAP包格式。包体之间需要用换行符号隔开。1 --part20111027095621这里有个\r\n2 Content-Type: text/xml; charsetUTF-8 这里有个\r\n3 Content-Transfer-Encoding: binary 这里有个\r\n4 Content-ID: SOAP-ENV:Envelope 这里有个\r\n 还需要在来一个\r\n空一行5 6 ?xml version1.0 encodingUTF-8 ? 根据包格式组包成功后和电信对接测试一直不能成功。 包体和附件附件中协议和附件体具体格式请参照上面成功的包。 这个换行一定要注意不然post就不能成功。返回的数据格式为?xml version1.0 encodingUTF-8?SOAP-ENV:Envelope xmlns:SOAP-ENVhttp://schemas.xmlsoap.org/soap/envelope/ xmlns:SOAP-ENChttp://schemas.xmlsoap.org/soap/encoding/ xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:xsdhttp://www.w3.org/2001/XMLSchema xmlns:comm3http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1 xmlns:mm1http://www.chinatelecom.com.cn/schema/ctcc/multimedia_messaging/send/v2_2/local SOAP-ENV:Header comm3:NotifySOAPHeader spRevIdszsxd/spRevId spRevpassword123542/spRevpassword spId35101051/spId linkId01130545065586044505/linkId /comm3:NotifySOAPHeader /SOAP-ENV:Header SOAP-ENV:Body mm1:sendMessageResponse mm1:result19350101400120111824000490H/mm1:result /mm1:sendMessageResponse /SOAP-ENV:Body/SOAP-ENV:Envelope 程序处理Ok再此还要感谢Google的搜索和那位大哥的换行指导。 转载于:https://www.cnblogs.com/wenanry/archive/2012/01/20/2327945.html