sending an XML to a web service using PHP soapclient with certification I get a 404



I am dealing with a web service that wants me to use a certificate and sample XML to contact them. I decided to use SOAPclient although I don't really have much understanding of it. My script looks like this:



$url='http://ift.tt/1nd8GlG';
$cert = "CERTIFICATE.pem";
$xmlDocument = '<soapenv:Envelope xmlns:com="http://ift.tt/YlEHfo" xmlns:data="http://ift.tt/1nd8J0I" xmlns:soapenv="http://ift.tt/sVJIaE">
<soapenv:Header></soapenv:Header>
<soapenv:Body wsu:Id="id-1" xmlns:wsu="http://ift.tt/Hm2joJ">
<com:getNameID>
<com:objaInfo>
<data:firstName>Larry</data:firstName>
</com:objaInfo>
</com:getPreScreenOffers>
</soapenv:Body>
</soapenv:Envelope>';

ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($url,
array(
'local_cert'=>$cert,
'trace' => 1,
'encoding' => 'ISO-8859-1',
'cache_wsdl' => WSDL_CACHE_MEMORY
)
);

$xmlvar = new SoapVar(
"<ns1:xmlDocument>'.$xmlDocument.'</ns1:xmlDocument>", XSD_ANYXML
);
enter code here
$params->xmlDocument = (object)$xmlvar;
$save_result = $client->SaveProduct($params);
print_r($save_result);


When I do this I get:



Warning: SoapClient::SoapClient(http://ift.tt/1nd8GlG) [soapclient.soapclient]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /path/to/script.php on line 56.


Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "http://ift.tt/1nd8GlG" in /path/to/script.php on line 56


Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ift.tt/1nd8GlG' : failed to load external entity "http://ift.tt/1nd8GlG" in /path/to/script.php:56 Stack trace: #0 /path/to/script.php(56): SoapClient->SoapClient('https://the.websi...', Array) #1 {main} thrown in /path/to/script.php on line 56



I'm pretty sure I shouldn't be getting a 404 here. What are first things I should check to troubleshoot?


No comments:

Post a Comment