标签:php5 soap wsdl web server
本文以某公司iPhone 6手机预约接口开发为例,介绍PHP5下SOAP调用的实现过程。
extension=php_soap.dll然后将前面的;号去掉,然后重启web服务
<?php header("content-type:text/html;charset=utf-8"); try { $client = new SoapClient("http://***.ct10000.com/services/AcceptedBusiness?wsdl"); print_r($client->__getFunctions()); print_r($client->__getTypes()); } catch (SOAPFault $e) { print $e; } ?>在浏览器运行:http://localhost/soap.php后,返回结果如下
<?php header("content-type:text/html;charset=utf-8"); try { $client = new SoapClient('http://***.ct10000.com/services/AcceptedBusiness?wsdl'); $xml = " <?xml version='1.0' encoding='UTF-8' ?> <PACKAGE> <C3>**电信</C3> <C4></C4> <LINKMAN>张三</LINKMAN> <LINKNUM>13412341234</LINKNUM> <LINKADDRESS>广东深圳</LINKADDRESS> <REMARK>iPhone 6</REMARK> <CHANNEL></CHANNEL> <GRIDCODE>1111111111111111111111111111111</GRIDCODE> <AGENTCODE>2111</AGENTCODE> <KEY>1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111</KEY> </PACKAGE> "; $return = $client->introduceAcceptedBusinessByStandardInterface($xml); print_r($return); } catch (SOAPFault $e) { print_r('Exception:'.$e); } ?>在浏览器中执行后,返回
<?xml version="1.0" encoding="UTF-8"?> <PACKAGE> <STATUS>0</STATUS> <REASON>入单成功!</REASON> <ORDERSEQ>2014100905523549742</ORDERSEQ> </PACKAGE>
标签:php5 soap wsdl web server
原文地址:http://blog.csdn.net/pondbay/article/details/40115757