I\'m trying to make a SOAP request using soapClient class from PHP that\'s my code:
$xmlstr = <<
There is nothing like make an question to find the answer. I extended the SoapClient class and, in this way, I send the correct XML. That's the code:
/**
* Extend SoapClientClass
*/
class anotherSoapClient extends SoapClient {
function __construct($wsdl, $options) {
parent::__construct($wsdl, $options);
$this->server = new SoapServer($wsdl, $options);
}
public function __doRequest($request, $location, $action, $version) {
$result = parent::__doRequest($request, $location, $action, $version);
return $result;
}
function __anotherRequest($call, $params) {
$location = 'http://localhost:8090/mockCustomerManagementSoapHttpBinding';
$action = 'http://localhost:8090/mockCustomerManagementSoapHttpBinding/'.$call;
$request = $params;
$result =$this->__doRequest($request, $location, $action, '1');
return $result;
}
}
// Create new SOAP client
$wsdl = 'http://localhost:8090/mockCustomerManagementSoapHttpBinding?WSDL';
$client = new anotherSoapClient($wsdl, array(
'cache_wsdl' => WSDL_CACHE_NONE,
'cache_ttl' => 86400,
'trace' => true,
'exceptions' => true,
));
// Make the request
try {
$request = $client->__anotherRequest('getCustomerInfo', $XMLrequest);
} catch (SoapFault $e ){
echo "Last request:" . htmlentities($client->__getLastRequest()) . "
";
exit();
}
header('Content-type: text/xml');
echo $request;
I use the free version of SOAP_UI to test the response.