Thanks Cereal for helping with this.
The problem was my client was sending back extra charaters which were causing errors. These articles explain it in detail...
qa-byte-order-mark
detecting-utf-bom-byte-order-mark
I was still struggling to get the result I needed but the following solution from Cereal worked perfect, it emulates a Soap client and although it may not be an ideal solution for everyone because it requires more code its works for me!!!
<?php
$wsdl = "https://your-WSDL-address.com/courseinfo/courseinfo.asmx";
$soap = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://your-WSDL-address.com/"><SOAP-ENV:Body><ns1:getCourseInfo><ns1:centre>CO</ns1:centre></ns1:getCourseInfo></SOAP-ENV:Body></SOAP-ENV:Envelope>
EOD;
$length = strlen($soap);
$header = array(
"Host: your-WSDL-address.com",
"Connection: Keep-Alive",
"User-Agent: PHP-SOAP/5.5.9-1ubuntu4.9",
"Content-type: text/xml;charset=utf-8",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: \"http://your-WSDL-address.com/getCourseInfo\"",
"Content-Length: ".$length,
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $wsdl);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true );
curl_setopt($curl, CURLOPT_POSTFIELDS, $soap);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
# show request and response headers
curl_setopt($curl, CURLOPT_VERBOSE, true);
$response = curl_exec($curl);
if($response === false) {
$err = 'Curl error: ' . curl_error($curl);
curl_close($curl);
print PHP_EOL;
print $err;
print PHP_EOL;
} else {
curl_close($curl);
print 'Operation completed without any errors';
print PHP_EOL;
$load = simplexml_load_string($response);
# loading the namespace
$resp = $load->children("http://schemas.xmlsoap.org/soap/envelope/");
print_r($resp->Body->children());
}