Use PHP to call webservice. There is a very convenient encapsulation class nusoap, which can be downloaded at http://sourceforge.net/projects/nusoap/files/.
The use of NuSOAP is relatively simple. The most commonly used classes are soap_server and soapclient. The soap_server is used to create Webservice services, and the soapclient class is used to call Webservice. The definitions of these two classes are in lib/nusoap.php , so we need to reference this file when creating or calling the Webservice interface program.
require('lib/nusoap.php'); // $xml = '一段XML标签,由webservice的server端来规定,一般在接口文档里可以看到'; // $soapClient = new nusoap_client("webservice的调用地址",TRUE); //TRUE参数表示使用wsdl // $soapClient->xml_encoding = 'UTF-8'; //指定字符编码 // $soapClient->soap_defencoding = 'UTF-8'; // $parameters = array("参数1"=>"", "参数2"=>$xml); //参数也需要根据接口文档来写 // $outString = $soapClient->call("方法名", $parameters); // var_dump($outString);
The above has introduced how to simply use nusoap to call webservice, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.