PHP uses SOAP to call. net WebService. The project needs to exchange data with a. net system. the partner provides a WebService interface. This is a bit different from the general idea of using PHPPOST or GET to pass values and then check the database for data. you need to exchange data with a. net system, and the partner provides a WebService interface. This is a little different from the general idea of passing values through php post or GET and checking the database for data. The SOAP module is required, and the processing method is very simple. there are some things to be aware.
First, check that your PHP. ini has enabled. SOAP, that is, the semicolon before extension = php_soap.dll.
The code is simple:
Soap_defencoding = 'utf-8'; $ client-> decode_utf8 = false; $ client-> xml_encoding = 'utf-8 '; $ param = array ('param1' => '01', 'param2' => '02'); // $ param ["param1"] = "01 "; // $ param ["param2"] = "02"; // $ result = $ client->__ soapCall ("GetArticle", array ($ param )); $ result = $ client->__ Call ("GetArticle", array ($ param); if (is_soap_fault ($ result) {trigger_error ("SOAP Fault: (faultcode: {$ result-> faultcode}, fault String: {$ result-> faultstring}) ", E_USER_ERROR);} else {$ data = $ result-> GetArticleResult; // class is returned here, you must use-> to obtain the value of the element print_r ($ data) ;}?>
It should be noted that the parameter is an array containing an array outside the array, that is, array ())
Some parameters of the SOAP interface are attached:
The following are examples of SOAP 1.2 requests and responses. The displayed placeholder must be replaced with the actual value.
POST /SearchService.asmx HTTP/1.1Host: 202.105.183.61Content-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "http://tempuri.org/GetTrafficViolationInfo"
string
string
HTTP/1.1 200 OKContent-Type: text/xml; charset=utf-8Content-Length: length
string
Bytes. This is a little different from the general idea of passing values through php post or GET and checking the database for data...