Hi,

This is an example showing you how to send SOAP request using PHP and will get response if successful.

<?php
error_reporting(E_ALL);
ini_set(‘display_errors’, true);
ini_set(‘display_startup_errors’, true);

$test = ‘<xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”&gt;
<soap:Body>
<!–
Keep your XML here to send request using SOAP. And yo will get response by reading predefine XML tags.
–>
</soap:Body>
</soap:Envelope>’;

//Change this variables.
$location_URL = ‘http://write_your_location_url&#8217;;
$action_URL = “http://write_your_action_to_perform_url&#8221;;

$client = new SoapClient(null, array(
‘location’ => $location_URL,
‘uri’      => “”,
‘trace’    => 1,
));

try{
$order_return = $client->__doRequest($test,$location_URL,$action_URL,1);
//Get response from here
print_r($order_return);
}catch (SoapFault $exception){
var_dump(get_class($exception));
var_dump($exception);
}

?>

Advertisements