Tutorial by Examples

First, create a new SoapClient object, passing the URL to the WSDL file and optionally, an array of options. // Create a new client object using a WSDL URL $soap = new SoapClient('https://example.com/soap.wsdl', [ # This array and its values are optional 'soap_version' => SOAP_1_2, ...
This is similar to WSDL mode, except we pass NULL as the WSDL file and make sure to set the location and uri options. $soap = new SoapClient(NULL, [ 'location' => 'https://example.com/soap/endpoint', 'uri' => 'namespace' ]);
When creating a SOAP Client in PHP, you can also set a classmap key in the configuration array. This classmap defines which types defined in the WSDL should be mapped to actual classes, instead of the default StdClass. The reason you would want to do this is because you can get auto-completion of fi...
Sometimes we want to look at what is sent and received in the SOAP request. The following methods will return the XML in the request and response: SoapClient::__getLastRequest() SoapClient::__getLastRequestHeaders() SoapClient::__getLastResponse() SoapClient::__getLastResponseHeaders() For ex...

Page 1 of 1