• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Codejie's C++ Space

            Using C++

            GSOAP:添加附件


            ??? GSOAP對于附件的處理非常好,可以很靈活的修改附件各部分,也可以偷懶讓GSOAP自動生成所需部分~不錯~

            ??? 下面是一堆在測試GSOAP加附件時用到的亂碼,就放這里作記錄吧~

            ????//attachment
            ????
            //if(packet->m_uiContentLen?>?0?&&?packet->m_pContent?!=?NULL)
            ????
            //{
            ????
            //????soap_set_mime(req.soap,?NULL,?NULL);
            ????
            //????//if(soap_set_mime_attachment(req.soap,?packet->m_pContent,?packet->m_uiContentLen,?SOAP_MIME_BINARY,?"application/vnd.wap.multipart.related",?"<KH-MMS-SMIL>",?NULL,?NULL)?!=?SOAP_OK)
            ????
            //????//if(soap_set_mime_attachment(req.soap,?packet->m_pContent,?packet->m_uiContentLen,?SOAP_MIME_NONE,?"text/plain",?"<slide1.txt>",?"slide1.txt",?NULL)?!=?SOAP_OK)
            ????
            //????//if(soap_set_mime_attachment(req.soap,?packet->m_pContent,?packet->m_uiContentLen,?SOAP_MIME_BASE64,?"image/png",?"<1001417929.27019.9.camel@spectrolite>",?"corner-bottomright.png",?"attachment;?filename=corner-bottomright.png")?!=?SOAP_OK)
            ????
            //????if(soap_set_mime_attachment(req.soap,?const_cast<char*>(str.c_str()),?str.size(),?SOAP_MIME_NONE,?"application/vnd.wap.multipart.related;?charset=utf-8;?boundary=\"----=_Part_24362_271418.1110357304160\";?type=\"application/smil\";?start=\"<KM-MMS-SMIL>\"",?NULL,?NULL,?NULL)?!=?SOAP_OK)
            ????
            //????{
            ????
            //????????ACEX_LOG_OS(LM_WARNING,?"<CCoreMsgTask::OnClientTaskMMSSendMessage>Add?attachment?to?MIME?failed."?<<?std::endl);
            ????
            //????}
            ????
            //}
            ????soap_set_mime(req.soap,?NULL,?NULL);

            ????
            for(Packet::TContentVector::const_iterator?it?=?packet->m_vctContent.begin();?it?!=?packet->m_vctContent.end();?++?it)
            ????{
            ????????
            if(soap_set_mime_attachment(req.soap,?it->m_pData,?it->m_uiSize,?soap_mime_encoding(it->m_ucEncoding),?it->m_strType.c_str(),?(it->m_strID.empty()???NULL?:?it->m_strID.c_str()),?(it->m_strLocation.empty()???NULL?:?it->m_strLocation.c_str()),?(it->m_strDesc.empty()???NULL?:?it->m_strDesc.c_str()))?!=?SOAP_OK)
            ????????{
            ????????????ACEX_LOG_OS(LM_WARNING,?
            "<CCoreMsgTask::OnClientTaskMMSSendMessage>Add?attachment?to?MIME?failed."?<<?std::endl);
            ????????}
            ????}




            ??? <---------------看不見的分割線----------------------->

            ??? 今天測試了ISAG的MMS接口,一切順利~
            ??? 電信對于ISAG是否支持SMIL格式,自己也沒有底--“SMIL好像不支持的,你們測試一下。。。”從理論上將,如果ISAG僅僅是透傳SOAP附帶的各附件,那么附件是何種格式就和ISAG沒有關系了,而要看終端是否支持了。
            ??? 因此,在多附件下發成功的情況下,我們作了SMIL格式的測試--PASS!

            ??? 報文在這里,供參考。


            posted on 2009-08-06 18:01 codejie 閱讀(3629) 評論(41)  編輯 收藏 引用 所屬分類: C++隨筆而已

            評論

            # re: GSOAP:添加附件 2009-11-04 14:35 xiaobai

            你好 你的這個包結構能給我看看么謝謝
            jpytu@126.com  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-04 14:57 codejie

            @xiaobai
            不清楚你的需求是什么,可能答復不是你所需要的。
            MIME附件打包及其發送并不需要我們自己來封裝,GSOAP已經搞定這部分代碼了,只要按照其MIME相關函數的使用方法說明,應該不會有問題的。可能要多說的是,如果你的MIME附件有順序要求,那就需要按照順序‘添加’到GSOAP附件列表中。
            這里建議你先看看GSOAP文檔中的MIME部分說明,還有MIME規范。這兩部分是實現的基礎知識。  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 09:48 xiaobai

            你好 你有QQ之類的聯系方式嗎?
            我的QQ 88181776  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 10:04 codejie

            @xiaobai
            現在是么QQ,么MSN,只有mail了,工作環境所迫啊。。。
            我在HANGZHOU,如果你也在,那么長途費可以省了,否則,別電我,很貴的。。。嘿嘿~  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 10:07 xiaobai

            呵呵 我在哈爾濱哪 是不敢電你   回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 10:11 xiaobai

            那你能不能幫幫我啊 我都發快3周了.....也沒出去那 再發不去我就得被炒魷魚了
            我就是想向網關發個彩信 頭和 發送格式不會處理  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 10:46 xiaobai

            看來錢不是最重要的啊 你的電話介不介意告訴我
            我現在真想向你求助 我是真的不會啊 網上也沒有相關內容
            幫助文檔就看到兩個發送函數
            soap_set_mime()
            soap_set_mime_attachment()
            我英語學的不好 也沒看出啥實質的東西
            ....我以前沒用這東西 網上相關資料也少 我真的很無助 啊
            你要是不幫我 我真的做不出來了
              回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 13:51 codejie

            @xiaobai
            這樣,我不知道你所使用的MMS規范是哪份,不同的規范有著不同的定義,如果你們跟局方關系好,還能弄到WSDL文件。
            這里我想GSOAP你應該很熟悉了吧,那么你按照規范要求添加相應的頭和體部分,這些不是MIME,附件才是MIME,如果你只是發送一個文本消息,可能都用不到MIME了。
            你現在的情況是什么樣的?是發給網關無響應,還是收到了一個錯誤應答?建議你先用wirshark抓下報文看看。來確定是否發到對方了,是否對方應答了,要先檢查鏈路情況,然后在進一步定位是報文哪里出問題了。

            另:
            電話先別了,太貴了~你先看看,不行再說。
            哈爾濱不錯,我去過的~不過就記得太陽島和大面包了。。。
              回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 14:41 xiaobai

            其實我gsoap 一點也不熟啊我也是剛開始接觸的 是他們非讓我用的我以前都不知道這個軟件
            gsoap 的包頭是如何修改的?
              回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 14:43 codejie

            @xiaobai
            這里建議你先熟悉下GSOAP,然后你就會發現,一切跟SOAP相關的問題就不是問題了,剩下的都是業務問題了。  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 15:17 xiaobai

            POST / HTTP/1.1

            Host: 192.168.0.43:18030

            User-Agent: gSOAP/2.7

            Content-Type: multipart/related; boundary="==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B=="; type="application/dime"; start="<SOAP-ENV:Envelope>"

            Content-Length: 92205808

            Connection: close



            --==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B==

            Content-Type: application/dime

            Content-Transfer-Encoding: binary

            Content-ID: <SOAP-ENV:Envelope>



            . .....'....cid:id0.http://www.w3.org/2003/05/soap-envelope.<?xml version="1.0" encoding="UTF-8"?>
            <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:xmime4="http://www.w3.org/2004/11/xmlmime" xmlns:x="http://127.0.0.1/mtom_stream_test.xsd" xmlns:m="http://127.0.0.1/mtom_stream_test.wsdl"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><m:PutData><x:data><x:item xmime4:contentType="*/*"><xop:Include href="cid:id2"/></x:item></x:data></m:PutData></SOAP-ENV:Body></SOAP-ENV:Envelope>
            ........~.Tid2.*/*..$..................................................`5..........................................................p<...................................).........................................................................................................................8............................................................................ '..................................................D.......k...p...............................................................0...................................*/*..C..........cid:id2......>......9...........T.~.................................(...........cid:id2.....P............C...C.......................................................................................................................................................................................>E..........>E.........(7......Content-Type: multipart/mixed;
            .boundary="526c0d56-4059-40d6-b9fa-66097feaf500"

            --526c0d56-4059-40d6-b9fa-66097feaf500
            Content-Type: application/octet-stream;
            .name="logo1.png"
            Content-Transfer-Encoding: base64
            Content-Disposition: attachment;
            .filename="logo1.png"

            .....
            uo56pO3wsasMBoPBhL4tCZ3BYDAYDEbnEWYRMBgMBoPBhM5gMBgMBoMJncFgMBgMBhM6g8FgMBgM
            JnQGg8FgMJjQGQwGg8FgMKEzGAwGg8FgQmcwGAwGg8GEzmAwGAwGEzqDwWAwGIwew/8PAPOadpxW
            YtX/AAAAAElFTkSuQmCC
            ....

            --526c0d56-4059-40d6-b9fa-66097feaf500
            Content-Type: application/octet-stream;
            .name="mms.smil"
            Content-Transfer-Encoding: base64
            Content-Disposition: attachment;
            .filename="mms.smil"

            PHNtaWw+DQo8aGVhZD4NCjxtZXRhIG5hbWU9InRpdGxlIiBjb250ZW50PSJ0ZXN0NyIvPg0KPGxh
            eW91dD4NCjxyb290LWxheW91dCB3aWR0aD0iMzUyIiBoZWlnaHQ9IjE0NCIvPg0KPHJlZ2lvbiBp
            ZD0iSW1hZ2UiIHdpZHRoPSIxNzYiIGhlaWdodD0iMTQ0IiBsZWZ0PSIwIiB0b3A9IjAiIGZpdD0i
            bWVldCIvPg0KPHJlZ2lvbiBpZD0iVGV4dCIgd2lkdGg9IjE3NiIgaGVpZ2h0PSIxNDQiIGxlZnQ9
            IjE3NiIgdG9wPSIwIiBmaXQ9InNjcm9sbCIvPg0KPC9sYXlvdXQ+DQo8L2hlYWQ+DQo8Ym9keT4N
            CjxwYXIgZHVyPSI1cyI+DQo8aW1nIHNyYz0ibG9nbzEucG5nIiByZWdpb249IkltYWdlIi8+DQo8
            L3Bhcj4NCjwvYm9keT4NCjwvc21pbD4NCg==

            --526c0d56-4059-40d6-b9fa-66097feaf500
              回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 15:20 xiaobai

            你看這是我的報文 結果和你那差遠 了
            我估計是header的問題 不過這我不知道怎么改,應該改成什么樣  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-05 15:55 codejie

            @xiaobai
            從報文看,你的SOAP報文部分內容都是空的?不清楚你使用的MMS接口規范是怎么定義的,不過想來應該是你SOAP部分組包不對。
            GSOAP對SOAP部分的支持還是很好的,一般不需要修改的,我修改純粹因為WSDL文檔定義的不好,被比無奈啊。這里還是建議你先看看GSOAP的使用,然后在看看規范是怎么要求打SOAP-ENV部分報文的。沒有規范,我也不清楚SOAP-ENV該什么樣的。  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-06 20:11 xiaobai

            嘻嘻 再幫幫我
            POST / HTTP/1.1

            Host: 192.168.0.43:18030

            User-Agent: gSOAP/2.7

            Content-Type: multipart/related; boundary="==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B=="; type="text/xml"; start="<SOAP-ENV:Envelope>"

            Content-Length: 14782

            Connection: close

            SOAPAction: ""



            --==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B==

            Content-Type: text/xml; charset=utf-8

            Content-Transfer-Encoding: binary

            Content-ID: <SOAP-ENV:Envelope>



            <?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:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><mm7:DeliverReq><MessageType>MM7-Deliver.req</MessageType><TransactionID>442214</TransactionID><Sender>13951900000</Sender><MM7Version>5.2.0</MM7Version></mm7:DeliverReq></SOAP-ENV:Body></SOAP-ENV:Envelope>

            --==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B==

            Content-Type: image/png

            Content-Transfer-Encoding: base64

            Content-ID: logo1.png



            PHNtaWw+DQo8aGVhZD4NCjxtZXRhIG5hbWU9InRpdGxlIiBjb250ZW50PSJ0ZXN0NyIvPg0KPGxh
            eW91dD4NCjxyb290LWxheW91dCB3aWR0aD0iMzUyIiBoZWlnaHQ9IjE0NCIvPg0KPHJlZ2lvbiBp
            wLni/PRZ3ydH6BRVP0uD6HR16IahE1ofPzJZjTUp327vVdaK4Hv9jIe2ELpIw0iV7vDB/bzPvMM4
            hSJRhEIhhCIx8W9U5+d51N4jnOOXQDAYDEbvgwm9vdF7CsCw+Nc27pxyCVVDcq+TuCFcQeBzTOAM
            BoPBhM6EHkzyKdQOrrFEJG9BcpBNG1EnbgfADdROcMvzS1IYDAaDCZ0JvTVE7yX2OuEDwJAh4deJ
            uo56pO3wsasMBoPBhL4tCZ3BYDAYDEbnEWYRMBgMBoPBhM5gMBgMBoMJncFgMBgMBhM6g8FgMBgM
            JnQGg8FgMJjQGQwGg8FgMKEzGAwGg8FgQmcwGAwGg8GEzmAwGAwGEzqDwWAwGIwew/8PAPOadpxW
            YtX/AAAAAElFTkSuQmCC

            --==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B==

            Content-Type: text/xml

            Content-Transfer-Encoding: base64

            Content-ID: mms.smil



            PHNtaWw+DQo8aGVhZD4NCjxtZXRhIG5hbWU9InRpdGxlIiBjb250ZW50PSJ0ZXN0NyIvPg0KPGxh
            eW91dD4NCjxyb290LWxheW91dCB3aWR0aD0iMzUyIiBoZWlnaHQ9IjE0NCIvPg0KPHJlZ2lvbiBp
            ZD0iSW1hZ2UiIHdpZHRoPSIxNzYiIGhlaWdodD0iMTQ0IiBsZWZ0PSIwIiB0b3A9IjAiIGZpdD0i
            bWVldCIvPg0KPHJlZ2lvbiBpZD0iVGV4dCIgd2lkdGg9IjE3NiIgaGVpZ2h0PSIxNDQiIGxlZnQ9
            IjE3NiIgdG9wPSIwIiBmaXQ9InNjcm9sbCIvPg0KPC9sYXlvdXQ+DQo8L2hlYWQ+DQo8Ym9keT4N
            CjxwYXIgZHVyPSI1cyI+DQo8aW1nIHNyYz0ibG9nbzEucG5nIiByZWdpb249IkltYWdlIi8+DQo8
            L3Bhcj4NCjwvYm9keT4NCjwvc21pbD4NCg==

            --==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B==--  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-06 20:13 xiaobai

            雖然和你那個很像了 還是無法和網關通信 可能哪出問題了那?
            我的這個網關是不需要用戶名密碼的  回復  更多評論   

            # re: GSOAP:添加附件[未登錄] 2009-11-06 21:41 codejie

            @xiaobai
            你收到網關的應答沒有?應答的內容是什么?正確嘛?  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-10 15:27 xiaobai

            嘻嘻 再幫我看下 這是我的soap
            <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:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0"><SOAP-ENV:Header><mm7:TransactionID SOAP-ENV:mustUnderstand="1">444165</mm7:TransactionID></SOAP-ENV:Header><SOAP-ENV:Body><mm7:SubmitReq><MM7Version>5.2.0</MM7Version><SenderIdentification><VASPID>9999</VASPID><VASID>400</VASID><SenderAddress>15900044452011</SenderAddress></SenderIdentification><Recipients><To><Number>150150150150</Number></To></Recipients><ServiceCode>4</ServiceCode><DeliveryReport>False</DeliveryReport><Subject>this test</Subject></mm7:SubmitReq></SOAP-ENV:Body></SOAP-ENV:Envelope>
            這是網關返回的信息
            <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:Header><TransactionID xmlns="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0" soap-env:mustUnderstand="1">644511</TransactionID></soap-env:Header><soap-env:Body><mm7:VASPErrorRsp xmlns:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0"><MM7Version>5.2.0</MM7Version><Status><StatusCode>4004</StatusCode></Status></mm7:VASPErrorRsp></soap-env:Body></soap-env:Envelope>
            他說驗證錯誤 可能是哪錯了?
              回復  更多評論   

            # re: GSOAP:添加附件 2009-11-10 16:41 codejie

            @xiaobai
            恭喜啊~看Header和Body都有數據了,不錯~
            網關響應的錯誤是4004,這個你要看手里的接口規范了,先看看這個4004代表什么,如可能就是說‘Sender不存在’或者‘缺少xxx字段’等應用層錯誤,而這類錯誤很好解決的。所以,建議趕緊看看規范怎么說的~(我沒有你用的接口規范,無法定位錯誤的。)  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-10 17:35 xiaobai

            4004 的解釋就是驗證錯誤
            不過他沒給錯誤描述 能強制調出錯誤信息嗎?  回復  更多評論   

            # re: GSOAP:添加附件[未登錄] 2009-11-10 21:12 codejie

            @xiaobai
            驗證什么錯誤?是sender錯,還是內容錯呢?如果規范沒有說明,就只能問網關側了,應該不會有啥方法“強制調出錯誤信息”,這些錯誤完全是協議規范定義的。你到底用的是什么規范啊,哪里定的?應該有錯誤說明的。  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-12 16:45 xiaobai

            請問 在gsoap 中 這種節點是怎么加上去的?
            <Content href="cid:mms_cid"/>  回復  更多評論   

            # re: GSOAP:添加附件[未登錄] 2009-11-12 20:19 codejie

            @xiaobai
            這個是MIME部分吧?如何是,那GSOAP自己會添加的,在添加附件的時候指定的。我不記得手工加過這段。  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-13 15:10 xiaobai

            網關返回 缺少ContentType節點怎么辦 ?
            下面是我 的soap包
            POST / HTTP/1.1

            Host: 192.168.0.64:55603

            User-Agent: gSOAP/2.7

            Content-Type: multipart/related; boundary="==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B=="; type="text/xml"; start="<SOAP-ENV:Envelope>"

            Content-Length: 1049

            Connection: close

            SOAPAction: ""



            --==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B==

            Content-Type: text/xml; charset=utf-8

            Content-Transfer-Encoding: binary

            Content-ID: <SOAP-ENV:Envelope>



            <?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:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0"><SOAP-ENV:Header><mm7:TransactionID SOAP-ENV:mustUnderstand="1">444165</mm7:TransactionID></SOAP-ENV:Header><SOAP-ENV:Body><mm7:DeliverReq><MM7Version>5.2.0</MM7Version><SenderIdentification><SenderAddress>15900445201</SenderAddress></SenderIdentification><Sender>15912345678</Sender><LinkedID>6060</LinkedID><ContentType>multipart/mixed</ContentType><Content href="cid: id0"></Content></mm7:DeliverReq></SOAP-ENV:Body></SOAP-ENV:Envelope>

            --==nGpzR/KspN6ry7jG8CU4bonN2aujzfJamyN3xYjaldFXYpeUryNGb0UROC0B==--  回復  更多評論   

            # re: GSOAP:添加附件 2009-11-13 16:44 xiaobai

            soap_set_mime_attachment ()這個函數是只掛載附件把
            那執行附件放送的方法怎么弄?  回復  更多評論   

            # re: GSOAP:添加附件[未登錄] 2009-11-14 12:30 codejie

            @xiaobai
            對于GSOAP來說,附件附上之后,發送過程GSOAP自己會搞定的,就跟沒有附件一樣的過程。  回復  更多評論   

            # re: GSOAP:添加附件 2009-12-24 11:17 lmode

            我現在發送一個wap push 的請求,得到錯誤SOAP 1.1 fault: SOAP-ENV:Server.generalException [no subcode]
            ""
            Detail:
            我通過在代碼中打印有看到消息發送到服務端,服務端也有返回,現在就是想知道如何打印我發送請求的報文,想看看我打包的soap包有沒有問題,我用wireshark抓過包,好像抓不完整...  回復  更多評論   

            # re: GSOAP:添加附件 2009-12-24 11:28 lmode

            printf("soap len=%d\n",soap.buflen);
            printf("soap buf=%s\n",soap.buf);
            這2個可以打印出來..
              回復  更多評論   

            # re: GSOAP:添加附件 2009-12-24 11:36 codejie

            wireshark如果抓的不完整,首先需要考慮的應該是是否發送的完整?因此最好先檢查一下發送的代碼是否正常。

            另:
            buf的打印盡量不要用%s方式,雖然buf的內容都是由可見的ASCII組成,但這里還是建議用dumphex方式打印~這樣的好處很多,簡單說如果你的buf寫的不對,一個\0,你就什么都不知道了~  回復  更多評論   

            # re: GSOAP:添加附件 2009-12-24 16:53 lmode

            <?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:ns2="http://www.chinatelecom.com.cn/schema/ctcc/wap_push/send/v1_0/local"
            xmlns:ns5="http://www.chinatelecom.com.cn/schema/ctcc/wap_push/v1_0"
            xmlns:ns4="http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1"
            xmlns:ns1="http://www.chinatelecom.com.cn/wsdl/ctcc/wap_push/send/v1_0/service"
            xmlns:headerNS="http://customeheader.test.com">
            <SOAP-ENV:Header>
            <headerNS:spId>14100389</headerNS:spId>
            <headerNS:spPassword>4B4588F7B29D96D5C9D169F90B03B9DC</headerNS:spPassword>
            <headerNS:timeStamp>0212123008</headerNS:timeStamp>
            <headerNS:productId>114000000000000001794</headerNS:productId>
            <headerNS:SAN>10659233</headerNS:SAN>
            <headerNS:transactionId></headerNS:transactionId>
            <headerNS:transEnd>0</headerNS:transEnd>
            <headerNS:linkId></headerNS:linkId>
            <headerNS:OA>tel:+8618906915906</headerNS:OA>
            <headerNS:FA>tel:+8618906915906</headerNS:FA>
            <headerNS:multicastMessaging>false</headerNS:multicastMessaging>
            </SOAP-ENV:Header>
            <SOAP-ENV:Body>
            <ns2:sendMessage>
            <ns2:addresses>tel:+8618906915906</ns2:addresses>
            <ns2:targetURL>www.qq.com</ns2:targetURL>
            <ns2:senderAddress>hello</ns2:senderAddress>
            <ns2:subject>wap push test</ns2:subject>
            <ns2:priority>Normal</ns2:priority>
            <ns2:charging>
            <description>des</description>
            <currency>81</currency>
            <amount>82</amount>
            <code>83</code>
            </ns2:charging>
            <ns2:receiptRequest>
            <endpoint>http://xxx.xxx.xxx.xxx:5080/isag/North/WPS/WapMessageNotification</endpoint>
            <interfaceName>SendSms</interfaceName>
            <correlator>1000002220</correlator>
            </ns2:receiptRequest>
            </ns2:sendMessage>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>

            這個是我發送的消息,網關回復的錯誤信息是soapheader錯誤  回復  更多評論   

            # re: GSOAP:添加附件 2009-12-24 16:55 lmode

            <?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>
            <ns1:RequestSOAPHeader
            soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
            soapenv:mustUnderstand="0"
            xmlns:ns1="http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1">
            <ns1:spId>14150389</ns1:spId>
            <ns1:productId>114000000000000001794</ns1:productId>
            <ns1:timeStamp>0212123008</ns1:timeStamp>
            <ns1:spPassword>4B4588F7B29D96D5C9D169F90B03B9DC</ns1:spPassword>
            <ns1:OA>tel:+8618959140245</ns1:OA>
            <ns1:FA>tel:+8618995140245</ns1:FA>
            <ns1:SAN>10659233</ns1:SAN>
            </ns1:RequestSOAPHeader>
            </soapenv:Header>
            <soapenv:Body>
            <sendMessage xmlns="http://www.chinatelecom.com.cn/schema/ctcc/wap_push/send/v1_0/local">
            <addresses>tel:+8618959140245</addresses>
            <targetURL>www.qq.com</targetURL>
            <senderAddress>10659233</senderAddress>
            <subject>wapPush</subject>
            <priority>Normal</priority>
            <charging>
            <description xmlns="">des</description>
            <currency xmlns="">88</currency>
            <amount xmlns="">88</amount>
            <code xmlns="">88</code>
            </charging>
            <receiptRequest>
            <endpoint xmlns="">http://xxx.xxx.xxx.xxx:8180/webapp/services/WapMessageNotification</endpoint>
            <interfaceName xmlns="">SendSms</interfaceName>
            <correlator xmlns="">1000002220</correlator>
            </receiptRequest>
            </sendMessage>
            </soapenv:Body>
            </soapenv:Envelope>

            這個是別人給我的模板,差了一個RequestSOAPHeader 標簽,這個是怎樣加上去的?  回復  更多評論   

            # re: GSOAP:添加附件 2009-12-25 09:43 codejie

            別人的模板并不是唯一正確的,尤其在‘域名’的地方是可以隨意的。這里建議你所使用的WSDL文件是否和服務端要求的一樣。
            對于GSOAP來說,如果由WSDL產生的文件符合協議要求,那么你按照正常填充就OK了,不會有太大問題。
            當然如果是GSOAP自己產生的文件不符合WSDL文件,那么你就不得不自己添加一些代碼了。我這里還有一篇說SOAP如何添加的帖子,請參考'http://www.shnenglu.com/codejie/archive/2009/07/13/89972.html'.  回復  更多評論   

            # re: GSOAP:添加附件 2010-01-14 15:56 lmode

            如何接收帶soapheader的消息,我可以接收到soapbody的內容,但是header的確是空值  回復  更多評論   

            # re: GSOAP:添加附件 2010-01-14 17:59 codejie

            @lmode
            如果你使用的是GSOAP的話,這應該不是問題,GSOAP會自動將SOAP報文中的內容分解到相對應的結構中。
            或是我理解問題不對,你有更詳細的問題描述嗎?  回復  更多評論   

            # re: GSOAP:添加附件 2010-01-15 09:19 lmode

            嗯,是用gsoap的,我客戶端發送的消息內容是
            <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/wap_push/v1_0" xmlns:ns2="http://www.chinatelecom.com.cn/schema/ctcc/wap_push/notification/v1_0/local" xmlns:ns4="http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1" xmlns:ns1="http://www.chinatelecom.com.cn/wsdl/ctcc/wap_push/notification/v1_0/service"><SOAP-ENV:Header><ns1:NotifySOAPHeader><spRevId>14101163</spRevId><spRevpassword>2EBEC22DBC8D2EF87C3541B78F47EA98</spRevpassword><spId>14101164</spId><SAN>san</SAN><transactionId>transactionId</transactionId><linkId>linkid</linkId></ns1:NotifySOAPHeader></SOAP-ENV:Header><SOAP-ENV:Body><ns2:notifyMessageDeliveryReceipt><ns2:correlator>1234567890</ns2:correlator><ns2:deliveryStatus><address>059188389911</address><status>DeliveredToNetwork</status></ns2:deliveryStatus></ns2:notifyMessageDeliveryReceipt></SOAP-ENV:Body></SOAP-ENV:Envelope>

            在服務端soap_serve接收消息完消息后,
            可以打印correlator,address,status的值,但是通過soap->header確打不出soap頭的相關信息  回復  更多評論   

            # re: GSOAP:添加附件 2010-01-15 09:30 codejie

            @lmode
            不該有你這樣的現象的,你查看一下Header對應的structure,報文中Header的內容應該有相應的字段的。  回復  更多評論   

            # re: GSOAP:添加附件 2010-01-15 09:41 lmode

            struct SOAP_ENV__Header
            {
            #ifdef WITH_NOEMPTYSTRUCT
            char dummy; /* dummy member to enable compilation */
            #endif
            struct ns4__RequestSOAPHeader* ns4_ReqSoapHeader;
            struct ns4__NotifySOAPHeader* ns4_NotifySoapHeader;
            };
            我用
            printf("spRevId=%s\n",soap->header->ns4_NotifySoapHeader->spRevId);打印,程序異常退出,soap->header->ns4_NotifySoapHeader->spRevId按%d打印為0,地址未分配  回復  更多評論   

            # re: GSOAP:添加附件 2010-01-15 10:40 codejie

            @lmode
            我沒有關注你使用的協議,只是根據一般協議描述來說,
            1.sprevid是可以不存在的,因此,printf前需要檢查其值是否存在;
            2.根據GSOAP的慣用,sprevid可能是個復合結構,也許不能直接用printf的,建議你檢查一下sprevid的結構定義先;
            3.如果報文顯示sprevid有內容,但結構為NULL,那么就是說你的header并沒有解開,也許是沒有添加處理Header的代碼,GSOAP在頭上的處理有些問題,但一般都是由于WSDL文件不準確所致,請參考‘http://www.shnenglu.com/codejie/archive/2009/07/13/89972.html’先。  回復  更多評論   

            # re: GSOAP:添加附件 2010-01-15 16:28 lmode

            我按你給的鏈接,添加了相關的代碼
            a->ns4_NotifySoapHeader = soap_in_ns4__NotifySOAPHeader(soap, "-ns1:NotifySOAPHeader", a->ns4_NotifySoapHeader, "");
            返回成功,char* spRevId依舊為NULL,但是我跟蹤soap_in_ns4__NotifySOAPHeader這個函數進去
            在執行if (soap_in_string(soap, "spRevId", &a->spRevId, "xsd:string"))語句的時候,確是失敗的,報文中tag=ns1:NotifySOAPHeader,和我函數設置的是一致的.不知道什么原因了..  回復  更多評論   

            # re: GSOAP:添加附件頭 2010-03-08 17:20 lmode

            soap_set_mime(soap, NULL, NULL);
            if(soap_set_mime_attachment(soap,NULL,0, SOAP_MIME_8BIT, "multipart/related;start=\"animations.smil\";type=\"application/smil\";boundary=\"SubPart_7452684322002_77645\"","mime head", NULL, NULL) != SOAP_OK)
            printf("soap_set_mime_attachment smil failed");
            for(AppendixVectoriter it = AppendixVec.begin(); it != AppendixVec.end(); ++ it)
            {
            if(soap_set_mime_attachment(soap, it->m_pData, it->m_uiSize, soap_mime_encoding(it->m_ucEncoding), it->m_strType.c_str(), (it->m_strID.empty() ? NULL : it->m_strID.c_str()), (it->m_strLocation.empty() ? NULL : it->m_strLocation.c_str()), (it->m_strDesc.empty() ? NULL : it->m_strDesc.c_str())) != SOAP_OK)
            printf("soap_set_mime_attachment failed");
            }

            子分隔符SubPart_7452684322002_77645 不起作用.附件頭怎么加?  回復  更多評論   

            # re: GSOAP:添加附件 2010-03-08 17:43 codejie

            @lmode
            印象中,分隔符讓gsoap自己完成比較好,反正我好像是沒有對attachment對象添加這么多參數的。  回復  更多評論   

            # re: GSOAP:添加附件頭 2010-03-08 18:05 lmode

            我現在沒找到好辦法,就直接自己構造了...  回復  更多評論   

            公告

            Using C++

            導航

            統計

            留言簿(73)

            隨筆分類(513)

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品亚洲一区二区三区浴池 | 亚洲七七久久精品中文国产| 亚洲AV日韩精品久久久久| 久久久久99精品成人片| 国产一区二区精品久久岳| 热re99久久精品国产99热| 精品国产乱码久久久久久郑州公司| 亚洲AV日韩AV永久无码久久| 99久久精品免费看国产一区二区三区| 久久天天躁狠狠躁夜夜2020一| 久久亚洲国产最新网站| 亚洲精品NV久久久久久久久久| 伊人久久大香线蕉综合热线| 久久午夜福利无码1000合集| 国产成人无码精品久久久性色| 亚洲va久久久噜噜噜久久男同| 久久夜色精品国产噜噜亚洲AV| 久久国产亚洲精品无码| 国内精品久久国产大陆| 岛国搬运www久久| 久久无码高潮喷水| 久久精品国产亚洲av水果派| 蜜桃麻豆www久久| 久久91精品国产91久| 97久久精品无码一区二区天美| 精品久久久久久无码国产| 久久九九久精品国产免费直播| 国产精品一区二区久久国产| 久久高潮一级毛片免费| 99蜜桃臀久久久欧美精品网站| 人人狠狠综合久久亚洲88| 一本色道久久综合狠狠躁篇 | 97超级碰碰碰久久久久| 久久激情五月丁香伊人| 亚洲午夜久久久久久久久久| 伊人色综合久久| 国内精品久久久久久久久电影网| 久久免费高清视频| 亚洲AV日韩AV永久无码久久| 欧美午夜A∨大片久久| 久久国产精品99久久久久久老狼|