Jump to content

Recommended Posts

I am working with myDHL API and not getting a  null response from their API. When i look into the fault code its showing an env:server. Their support is not helpful so need some help here.

Any help what i am doing wrong here.

I  tried using the Soap class using the code below

$request=<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <soap:Header><wsse:Security soapenv:mustunderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-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 > test</wsse:Username >           
                <wsse:Password type = "PasswordText" >test</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 > 2020 - 04 - 24 20:17:21 </wsu:Created >
             </wsse:UsernameToken >
          </wsse:Security >
    </soap:Header>
       <soap:Body>
          <ShipmentRequest xmlns="http://scxgxtt.phx-dc.dhl.com/euExpressRateBook/ShipmentMsgRequest">
             <MessageId xmlns="">c68d7150bbd611e2b09ad103c98eed12</MessageId>
             <ClientDetail xmlns=""/>
             <RequestedShipment xmlns="">
                <ShipmentInfo>
                   <DropOffType>REGULAR_PICKUP</DropOffType>
                   <ServiceType>P</ServiceType>
                   <Account>4324324324</Account>
                   <Currency>EUR</Currency>
                   <UnitOfMeasurement>SI</UnitOfMeasurement>
                </ShipmentInfo>
                <ShipTimestamp>2019-10-24T14:01:22GMT+00:00</ShipTimestamp>
                <PaymentInfo>DDU</PaymentInfo>
                <InternationalDetail>
                   <Commodities>
                      <NumberOfPieces>1</NumberOfPieces>
                      <Description>Documents</Description>
                      <CustomsValue>10</CustomsValue>
                      <CountryOfManufacture>ES</CountryOfManufacture>
                   </Commodities>
                </InternationalDetail>
                <Ship>
                   <Shipper>
                      <Contact>
                         <PersonName>Karlos Espana</PersonName>
                         <CompanyName>SHIPING LTD</CompanyName>
                         <PhoneNumber>3848211</PhoneNumber>
                      </Contact>
                      <Address>
                         <StreetLines>DEL STREETO 9</StreetLines>
                         <City>SANT CUGAT DEL VALLES</City>
                         <PostalCode>08173</PostalCode>
                         <CountryCode>ES</CountryCode>
                      </Address>
                   </Shipper>
                   <Recipient>
                      <Contact>
                         <PersonName>Martin Soltys</PersonName>
                         <CompanyName>DHL</CompanyName>
                         <PhoneNumber>731731731</PhoneNumber>
                      </Contact>
                      <Address>
                         <StreetLines>V Parku 2308/10</StreetLines>
                         <City>Prague</City>
                         <PostalCode>14800</PostalCode>
                         <CountryCode>CZ</CountryCode>
                      </Address>
                   </Recipient>
                </Ship>
                <Packages>
                   <RequestedPackages number="1">
                      <Weight>1</Weight>
                      <Dimensions>
                         <Length>35</Length>
                         <Width>25</Width>
                         <Height>1</Height>
                      </Dimensions>
                      <CustomerReferences>LC MAGIC NUMBER 0037</CustomerReferences>
                   </RequestedPackages>
                </Packages>
             </RequestedShipment>
          </ShipmentRequest>
       </soap:Body>
    </soap:Envelope>

    

   

 $url = 'https://wsbexpress.dhl.com:443/sndpt/expressRateBook';
        $action = 'createShipmentRequest';
        try {
            $client = new SoapClient($path_to_wsdl);
            $response =$client->createShipmentRequest($request);
        } catch (SoapFault $fault) {
            echo "<h2>SOAP Fault!</h2><p>";
            echo "FaultCode: {$fault->faultcode} <br/>";
            echo "FaultString: {$fault->faultstring} <br/>";
            echo"</p/>";
        }

 

Link to comment
https://forums.phpfreaks.com/topic/310639-mydhl-soap-request/
Share on other sites

What's the fault code and string it should output on failure? The docs state that SoapClient::__construct() will throw a SoapFault exception if the WSDL URI can't be loaded - it doesn't look like your endpoint is WSDL.

Edited by maxxd
forgot a word
Link to comment
https://forums.phpfreaks.com/topic/310639-mydhl-soap-request/#findComment-1577190
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.