title: DHL trackShipmentRequest - WDSL - PHP - SOAP
body: <p>First post so forgive any breach of forum rules etc.
  I am trying to use the DHL api to track shipments.</p>
  
  <p>Here is the code i have currently</p>
  
  <pre><code>$client = new SoapClient("https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl");
      //$header     = new SoapHeader("https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl", "APICredentials", $auth, false); 
      //$client-&gt;__setLocation('https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl');
  
      $header_part = '&lt;soapenv:Envelope xmlns:rat="https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl"
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;soapenv:Header&gt;
      &lt;wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-
      secext-1.0.xsd"&gt;
      &lt;wsse:UsernameToken wsu:Id="UsernameToken-5" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-
      wss-wssecurity-utility-1.0.xsd"&gt;
      &lt;wsse:Username&gt;myusername&lt;/wsse:Username&gt;
      &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-
      1.0#PasswordText"&gt;mypassword&lt;/wsse:Password&gt;
      &lt;wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-
      1.0#Base64Binary"&gt;eUYebYfsjztETJ4Urt8AJw==&lt;/wsse:Nonce&gt;
      &lt;wsu:Created&gt;2010-02-12T17:40:39.124Z&lt;/wsu:Created&gt;
      &lt;/wsse:UsernameToken&gt;
      &lt;/wsse:Security&gt;
      &lt;/soapenv:Header&gt;';
  
  
  
  
  $soap_var_header = new SoapVar( $header_part, XSD_ANYXML, null, null, null );
  $soap_header = new SoapHeader( 'https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack', 'wsse', $soap_var_header, true );
  $client-&gt;__setSoapHeaders($soap_header);
  </code></pre>
  
  <p>If i do </p>
  
  <p>var_dump($client->__getFunctions())</p>
  
  <p>I get the following:</p>
  
  <pre><code>array(1) { [0]=&gt; string(83) "trackShipmentRequestResponse trackShipmentRequest(trackShipmentRequest $parameters)" }
  </code></pre>
  
  <p>My question really is does anyone know how to then format the trackShipmentRequest</p>
  
  <pre><code>$client-&gt;trackShipmentRequest(what goes here);
  </code></pre>
  
  <p>Here is an example of the xml given to me by DHL to be used in soapui</p>
  
  <pre><code>    &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:trac="http://scxgxtt.phx-dc.dhl.com/glDHLExpressTrack/providers/services/trackShipment" xmlns:dhl="http://www.dhl.com"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;trac:trackShipmentRequest&gt;
           &lt;trackingRequest&gt;
              &lt;dhl:TrackingRequest&gt;
                 &lt;Request&gt;
                    &lt;ServiceHeader&gt;
                       &lt;MessageTime&gt;2013-05-13T10:17:20Z&lt;/MessageTime&gt;
                       &lt;MessageReference&gt;c68d7150bbd611e2b09ad103c98eed12&lt;/MessageReference&gt;
                    &lt;/ServiceHeader&gt;
                 &lt;/Request&gt;
                 &lt;!--Optional:--&gt;
                 &lt;AWBNumber&gt;
                    &lt;!--1 or more repetitions:--&gt;
                    &lt;ArrayOfAWBNumberItem&gt;2786552086&lt;/ArrayOfAWBNumberItem&gt;
                 &lt;/AWBNumber&gt;
                 &lt;!--Optional:--&gt;
                 &lt;LPNumber&gt;
                    &lt;!--1 or more repetitions:--&gt;
                    &lt;ArrayOfTrackingPieceIDItem&gt;?&lt;/ArrayOfTrackingPieceIDItem&gt;
                 &lt;/LPNumber&gt;
                 &lt;LevelOfDetails&gt;ALL_CHECK_POINTS&lt;/LevelOfDetails&gt;
                 &lt;!--Optional:--&gt;
                 &lt;PiecesEnabled&gt;B&lt;/PiecesEnabled&gt;
              &lt;/dhl:TrackingRequest&gt;
           &lt;/trackingRequest&gt;
        &lt;/trac:trackShipmentRequest&gt;
     &lt;/soapenv:Body&gt;
  
      &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>I realise there a similar topics on this site, but none seem to help.</p>