免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1395 | 回复: 0
打印 上一主题 下一主题

捕捉soap的xml形式 [复制链接]

论坛徽章:
27
CU大牛徽章
日期:2013-03-13 15:15:08CU大牛徽章
日期:2013-05-20 10:46:38CU大牛徽章
日期:2013-05-20 10:46:44CU大牛徽章
日期:2013-09-18 15:24:09CU大牛徽章
日期:2013-09-18 15:24:20CU大牛徽章
日期:2013-09-18 15:24:25CU大牛徽章
日期:2013-09-18 15:24:31CU大牛徽章
日期:2013-09-18 15:24:36CU大牛徽章
日期:2013-09-18 15:24:41CU大牛徽章
日期:2013-09-18 15:24:48CU大牛徽章
日期:2013-09-18 15:24:52处女座
日期:2013-09-27 17:45:43
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-21 08:44 |只看该作者 |倒序浏览
下面是我以前对Php的soap接口进行抓包分析出的结果,这个分析在当服务端或者客户端的Php没有安装soap模块时,可以使用构建xml的方式实现相同的功能
服务端:
  1. <?php
  2. $data = $HTTP_RAW_POST_DATA;
  3. $data = file_get_contents('php://input');
  4. $server = new SoapServer(null, array('uri' => "http://abc-soap-duba/"));
  5. $server->addFunction("sendtask");
  6. $server->handle($data);
  7. function sendtask()
  8. {
  9.     return "ok";
  10. }
  11. ?>
客户端代码
  1. <?php
  2. $client = new SoapClient(null, array('location' => "http://api.abc.cn/taskserver.php",
  3.                                      'uri' => "http://abc-soap-duba/"));
  4. $username="cdn@abc.cn";
  5. $password=md5("123456");
  6. $domain="www.abc.cn";
  7. $pathsizelist="/images/ad2.gif,4846,/images/ad3.gif,5788,/images/ico01.gif,1089,/images/logo.gif,1605";
  8. echo $client->sendtask($username,$password,$domain,$pathsizelist);
  9. ?>
客户端发出的数据:
  1. POST /b.php HTTP/1.1
  2. Host: api.abc.cn
  3. Connection: Keep-Alive
  4. User-Agent: PHP-SOAP/5.2.2
  5. Content-Type: text/xml; charset=utf-8
  6. SOAPAction: "http://abc-soap-duba/#sendtask"
  7. Content-Length: 766
  8. <?xml version="1.0" encoding="UTF-8"?>
  9. <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/">
  10. <SOAP-ENV:Body>
  11. <ns1:sendtask>
  12. <param0 xsi:type="xsd:string">cdn@abc.cn</param0>
  13. <param1 xsi:type="xsd:string">e10adc3949ba59abbe56e057f20f883e</param1>
  14. <param2 xsi:type="xsd:string">www.abc.cn</param2>
  15. <param3 xsi:type="xsd:string">/images/ad2.gif,4846,/images/ad3.gif,5788,/images/ico01.gif,1089,/images/logo.gif,1605</param3>
  16. </ns1:sendtask>
  17. </SOAP-ENV:Body>
  18. </SOAP-ENV:Envelope>
当server中没有改函数时返回的结果
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <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中有该函数时的结果
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <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/">
  3. <SOAP-ENV:Body>
  4. <ns1:sendtaskResponse>
  5. <return xsi:type="xsd:string">ok</return>
  6. </ns1:sendtaskResponse>
  7. </SOAP-ENV:Body>
  8. </SOAP-ENV:Envelope>
end
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP