php url web service that throws error, I can not find this error

0

It's my first time making this kind of connections, the idea is to obtain a series of values from this server.

"In theory" , the code should return a xml file.

This is my code:

$soap_request  = 'xml='.urlencode(trim('
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">
  <soap:Body>
    <WSGetReceiptTracking xmlns="\http://s5.stephytrackingonline.com\">
      <Username>MIUSER</Username>
      <Password>MIPASS</Password>
      <Serial>MISERIAL</Serial>
      <CustomerType>0</CustomerType>
      <Receipt>VALOR</Receipt>
    </WSGetReceiptTracking>
  </soap:Body>
</soap:Envelope>'));


$header = array(
    'POST /stows/stows.asmx HTTP/1.1',
    'Host: s5.stephytrackingonline.com',
    'Content-Type: text/xml; charset=utf-8',
    'Content-Length: '.strlen($soap_request),
);

$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, 'http://s5.stephytrackingonline.com/stows/stows.asmx?op=WSGetReceiptTracking');
curl_setopt($soap_do, CURLOPT_HEADER, false);
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($soap_do, CURLOPT_TIMEOUT,        100);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_HTTPHEADER,     $header);
curl_setopt($soap_do, CURLOPT_POST,           true);
curl_setopt($soap_do, CURLOPT_POSTFIELDS,     $soap_request);
curl_setopt($soap_do, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)');


$output = curl_exec($soap_do);
$info = curl_getinfo($soap_do);

if (curl_exec($soap_do) === FALSE) {
    $err = 'Curl error: ' . curl_error($soap_do);
    curl_close($soap_do);
    print $err;
}

else {
    curl_close($soap_do);
}

echo '<br><br><b>The server responded:</b> '.$info['http_code']."\n";
echo '<br><br><b>Output:</b> '.$output;
echo "\n";

And this is the response from the server provider:

POST /stows/stows.asmx HTTP/1.1
Host: s5.stephytrackingonline.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://s5.stephytrackingonline.com/WSGetReceiptTracking"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <WSGetReceiptTracking xmlns="http://s5.stephytrackingonline.com">
      <Username>string</Username>
      <Password>string</Password>
      <Serial>string</Serial>
      <CustomerType>string</CustomerType>
      <Receipt>string</Receipt>
      <Tracking>string</Tracking>
      <FromDate>string</FromDate>
      <ToDate>string</ToDate>
    </WSGetReceiptTracking>
  </soap:Body>
</soap:Envelope>
    
asked by Jose Doe 26.08.2016 в 23:23
source

1 answer

0

It seems that you are answering how you should make the call:

<WSGetReceiptTracking xmlns="http://s5.stephytrackingonline.com">
      <Username>string</Username>
      <Password>string</Password>
      <Serial>string</Serial>
      <CustomerType>string</CustomerType>
      <Receipt>string</Receipt>
      <Tracking>string</Tracking>
      <FromDate>string</FromDate>
      <ToDate>string</ToDate>
</WSGetReceiptTracking>

If you notice, you are omitting:

<Tracking>string</Tracking>
 <FromDate>string</FromDate>
<ToDate>string</ToDate>
    
answered by 02.09.2016 в 22:44