DHL trackShipmentRequest - WDSL - PHP - SOAP

First post, so forgive any violation of forum rules, etc. I am trying to use DHL api to track shipments.

Here is the code I currently have

$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->__setLocation('https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl'); $header_part = '<soapenv:Envelope xmlns:rat="https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity- secext-1.0.xsd"> <wsse:UsernameToken wsu:Id="UsernameToken-5" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401- wss-wssecurity-utility-1.0.xsd"> <wsse:Username>myusername</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile- 1.0#PasswordText">mypassword</wsse:Password> <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security- 1.0#Base64Binary">eUYebYfsjztETJ4Urt8AJw==</wsse:Nonce> <wsu:Created>2010-02-12T17:40:39.124Z</wsu:Created> </wsse:UsernameToken> </wsse:Security> </soapenv:Header>'; $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->__setSoapHeaders($soap_header); 

If i do

var_dump ($ client -> __ getFunctions ())

I get the following:

 array(1) { [0]=> string(83) "trackShipmentRequestResponse trackShipmentRequest(trackShipmentRequest $parameters)" } 

My question really is - does anyone know how to format trackShipmentRequest then

 $client->trackShipmentRequest(what goes here); 

Here is an xml example provided to me by DHL for use in soapui

  <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"> <soapenv:Header/> <soapenv:Body> <trac:trackShipmentRequest> <trackingRequest> <dhl:TrackingRequest> <Request> <ServiceHeader> <MessageTime>2013-05-13T10:17:20Z</MessageTime> <MessageReference>c68d7150bbd611e2b09ad103c98eed12</MessageReference> </ServiceHeader> </Request> <!--Optional:--> <AWBNumber> <!--1 or more repetitions:--> <ArrayOfAWBNumberItem>2786552086</ArrayOfAWBNumberItem> </AWBNumber> <!--Optional:--> <LPNumber> <!--1 or more repetitions:--> <ArrayOfTrackingPieceIDItem>?</ArrayOfTrackingPieceIDItem> </LPNumber> <LevelOfDetails>ALL_CHECK_POINTS</LevelOfDetails> <!--Optional:--> <PiecesEnabled>B</PiecesEnabled> </dhl:TrackingRequest> </trackingRequest> </trac:trackShipmentRequest> </soapenv:Body> </soapenv:Envelope> 

I understand there are similar topics on this site, but no one helps.

+4
source share
1 answer

The WSDL endpoint that you use in your first line

 new SoapClient("https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl"); 

doesn't even allow it. I do not think this will work. Usually, if you simply paste https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl into your browser, you can see the definition for most SOAP services from what I know.

Based on user comment555, the endpoint may be out of date, so you should contact DHL.

+1
source

All Articles