捕捉soap的xml形式

來源:互聯網
上載者:User

標籤:style   class   blog   code   java   http   

下面是我以前對Php的soap介面進行抓包分析出的結果,這個分析在當服務端或者用戶端的Php沒有安裝soap模組時,可以使用構建xml的方式實現相同的功能

服務端:
 $data = $HTTP_RAW_POST_DATA;$data = file_get_contents(‘php://input‘);$server = new SoapServer(null, array(‘uri‘ => "http://abc-soap-duba/"));$server->addFunction("sendtask");$server->handle($data);function sendtask(){    return "ok";}

用戶端代碼  

    <?php    $client = new SoapClient(null, array(‘location‘ => "http://api.abc.cn/taskserver.php",                                         ‘uri‘ => "http://abc-soap-duba/"));    $username="[email protected]";    $password=md5("123456");    $domain="www.abc.cn";    $pathsizelist="/images/ad2.gif,4846,/images/ad3.gif,5788,/images/ico01.gif,1089,/images/logo.gif,1605";    echo $client->sendtask($username,$password,$domain,$pathsizelist);    ?>

用戶端發出的資料:

    POST /b.php HTTP/1.1    Host: api.abc.cn    Connection: Keep-Alive    User-Agent: PHP-SOAP/5.2.2    Content-Type: text/xml; charset=utf-8    SOAPAction: "http://abc-soap-duba/#sendtask"    Content-Length: 766    <?xml version="1.0" encoding="UTF-8"?>    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://abc-soap-duba/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">    <SOAP-ENV:Body>    <ns1:sendtask>    <param0 xsi:type="xsd:string">[email protected]</param0>    <param1 xsi:type="xsd:string">e10adc3949ba59abbe56e057f20f883e</param1>    <param2 xsi:type="xsd:string">www.abc.cn</param2>    <param3 xsi:type="xsd:string">/images/ad2.gif,4846,/images/ad3.gif,5788,/images/ico01.gif,1089,/images/logo.gif,1605</param3>    </ns1:sendtask>    </SOAP-ENV:Body>    </SOAP-ENV:Envelope>

當server中沒有改函數時返回的結果

    <?xml version="1.0" encoding="UTF-8"?>    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Function ‘sendtasks‘ doesn‘t exist</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

當server中有該函數時的結果

    <?xml version="1.0" encoding="UTF-8"?>    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://abc-soap-duba/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">    <SOAP-ENV:Body>    <ns1:sendtaskResponse>    <return xsi:type="xsd:string">ok</return>    </ns1:sendtaskResponse>    </SOAP-ENV:Body>    </SOAP-ENV:Envelope>

end

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.