How to Get SoapClient to Send an Accept Header
Simple Object Access Protocol, or SOAP, is a web service protocol used to send and receive information. One of he things it can do is send and receive data headers. SOAP is frequently developed using the open-source PHP programming language, although it can also be programmed using extensible markup language, more commonly known as XML.
Instructions
-
-
1
Open your preferred code creation and editing program and create a new document where you can practice coding the SOAPclient coding.
-
2
Initiate the connection with the SOAP client server by using the following code. Replace the portions of the example that contain "some" with the actual usernames, passwords, and WSDL file names with which you're working:
<?php
$client = new SoapClient("some.wsdl");
$client = new SoapClient("some.wsdl", array('soap_version' => SOAP_1_2));
$client = new SoapClient("some.wsdl", array('login' => "some_name",
'password' => "some_password")); -
-
3
Specify the file format that the client should use when sending and receiving data. For example, the following code specifies GZIP file compression as the file format of the header being used:
$client = new SoapClient("some.wsdl",
array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP)); -
4
Close out the connection to the SOAP client after the header has been sent and accepted by using the following code:
$server = new SoapClient("some.wsdl", array('classmap' => array('example'=> "ExampleDatabase")));
?>
-
1