title: PHP and Royal Mail Tracking API
body: <p>We have been having some issues with setting up a PHP SOAP Client to make use of the Royal Mail Tracking API. We have an account all set up with Royal Mail and have our ID's and secrets. We can get it to work using SOAPUI but we are always getting a "Wrong Version" error when trying to implement it in PHP. We have the WSDL file locally (which Royal Mail provided via their developer portal) this works with SOAPUI but not PHP SOAP Client. We were hoping someone may be able to see if we are doing anything wrong. I'll post the code below but will omit our secret and ID from the code.</p>
  
  <pre><code>&lt;?php
  ini_set('soap.wsdl_cache_enabled', 0);
  ini_set('soap.wsdl_cache_ttl', 900);
  ini_set('default_socket_timeout', 15);
  
  $trackingNumber = 'F111111111JD';
  $time = gmdate('Y-m-d\TH:i:s');
  
  $intHeaders = [
      'dateTime' =&gt; $time,
      'version' =&gt; '1.0',
      'identification' =&gt; [
          'applicationId' =&gt; '***********',
          'transactionId' =&gt; 123456
      ]
  ];
  
  $wsdl = 'WSDL/Tracking_API_V1_1_1.wsdl';
  
  $options = array(
      'uri'=&gt;'http://schemas.xmlsoap.org/soap/envelope/',
      'style'=&gt;SOAP_RPC,
      'use'=&gt;SOAP_ENCODED,
      'soap_version'=&gt;SOAP_1_2,
      'cache_wsdl'=&gt;WSDL_CACHE_NONE,
      'connection_timeout'=&gt;15,
      'trace'=&gt;true,
      'encoding'=&gt;'UTF-8',
      'exceptions'=&gt;true,
      'stream_context' =&gt; stream_context_create([
          "http" =&gt; [
              'Accept' =&gt; 'application/soap+xml',
              'X-IBM-Client-Secret' =&gt; '****',
              'X-IBM-Client-Id'=&gt; '****'
          ]
      ])
  );
  try {
      $soap = new SoapClient($wsdl, $options);
      $data = $soap-&gt;getSingleItemHistory(['integrationHeader' =&gt; $intHeaders, 'trackingNumber' =&gt; $trackingNumber]);
  }
  catch(Exception $e) {
      die($e-&gt;getMessage());
  }
  
  var_dump($data);
  die;
  </code></pre>
  
  <p>We've tried using SOAP_1_1 and SOAP_1_2 for the 'soap_version' but it always comes back with the "Wrong Version" error.</p>
  
  <p>Hope someone is able to help.</p>