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:
Copy codeThe Code is as follows:
<? Php
$ Client = new SoapClient ('HTTP: // www.aa.net/SearchService.asmx? WSDL '); // Replace the SOAP address with your own
$ Client-> 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}, faultstring: {$ result-> faultstring})", E_USER_ERROR );
}
Else
{
$ Data = $ result-> GetArticleResult; // The returned class must be-> get the element value
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.
Copy codeThe Code is as follows:
POST or SearchService. asmx HTTP/1.1
Host: 202.105.183.61
Content-Type: text/xml; charset = UTF-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetTrafficViolationInfo"
<? Xml version = "1.0" encoding = "UTF-8"?>
<Soap: Envelope xmlns: xsi = "The http://www.w3.org/2001/XMLSchema-instance" xmlns: xsd = "The http://www.w3.org/2001/XMLSchema" xmlns: soap = "The http://schemas.xmlsoap.org/soap/envelope/">
<Soap: Body>
<GetArticle xmlns = "http://tempuri.org/">
<Param1> string </param1>
<Param2> string </param2>
</GetArticle>
</Soap: Body>
</Soap: Envelope>