title: myDHL API response
body: <p>I am working with myDHL API and getting a weird response from their API. Their support is not helpful so need some help here.</p>
  
  <p>My request XML is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ShipmentRequest xsi:noNamespaceSchemaLocation="ShipmentMsgRequest.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;shipreq:ShipmentRequest&gt;
          &lt;RequestedShipment&gt;
              &lt;ShipmentInfo&gt;
                  &lt;DropOffType&gt;REGULAR_PICKUP&lt;/DropOffType&gt;
                  &lt;ServiceType&gt;U&lt;/ServiceType&gt;
                  &lt;Account&gt;12345&lt;/Account&gt;
                  &lt;Currency&gt;USD&lt;/Currency&gt;
                  &lt;UnitOfMeasurement&gt;SI&lt;/UnitOfMeasurement&gt;
                  &lt;PackagesCount &gt;1&lt;/PackagesCount&gt;
                  &lt;LabelType&gt;PDF&lt;/LabelType&gt;
                  &lt;LabelTemplate&gt;ECOM26_84_001&lt;/LabelTemplate&gt;
              &lt;/ShipmentInfo&gt;
              &lt;ShipTimestamp&gt;&lt;/ShipTimestamp&gt;
              &lt;PaymentInfo&gt;DAP&lt;/PaymentInfo&gt;
              &lt;InternationalDetail&gt;
                  &lt;Commodities&gt;
                      &lt;NumberOfPieces&gt;1&lt;/NumberOfPieces&gt;
                      &lt;Description&gt;1&lt;/Description&gt;
                      &lt;Quantity&gt;1&lt;/Quantity&gt;
                      &lt;CustomsValue&gt;1.00&lt;/CustomsValue&gt;
                  &lt;/Commodities&gt;
                  &lt;Content&gt;1&lt;/Content&gt;
              &lt;/InternationalDetail&gt;
              &lt;Ship&gt;
                  &lt;Shipper&gt;
                      &lt;Contact&gt;
                          &lt;PersonName&gt;test&lt;/PersonName&gt;
                          &lt;CompanyName&gt;test1&lt;/CompanyName&gt;
                          &lt;PhoneNumber&gt;34324324&lt;/PhoneNumber&gt;
                      &lt;/Contact&gt;
                      &lt;Address&gt;
                          &lt;StreetLines&gt;address test/StreetLines&gt;
                          &lt;City&gt;Singapore&lt;/City&gt;
                          &lt;PostalCode&gt;343333&lt;/PostalCode&gt;
                          &lt;CountryCode&gt;SG&lt;/CountryCode&gt;
                      &lt;/Address&gt;
                  &lt;/Shipper&gt;
                  &lt;Recipient&gt;
                      &lt;Contact&gt;
                          &lt;PersonName&gt;John&lt;/PersonName&gt;
                          &lt;CompanyName&gt;ABC Worldwide&lt;/CompanyName&gt;
                          &lt;PhoneNumber&gt;1234567&lt;/PhoneNumber&gt;
                      &lt;/Contact&gt;
                      &lt;Address&gt;
                          &lt;StreetLines&gt;Private Bag 92019.Auckland Mail Centre.&lt;/StreetLines&gt;
                          &lt;City&gt;Auckland&lt;/City&gt;
                          &lt;PostalCode&gt;1011&lt;/PostalCode&gt;
                          &lt;CountryCode&gt;NZ&lt;/CountryCode&gt;
                      &lt;/Address&gt;
                  &lt;/Recipient&gt;
              &lt;/Ship&gt;
              &lt;Packages&gt;&lt;RequestedPackages number=1&gt;
                      &lt;InsuredValue&gt;1.00&lt;/InsuredValue&gt;
                      &lt;Weight&gt;1.00&lt;/Weight&gt;
                      &lt;Dimensions&gt;
                          &lt;Length&gt;1&lt;/Length&gt;
                          &lt;Width&gt;1&lt;/Width&gt;
                          &lt;Height&gt;1&lt;/Height&gt;
                      &lt;/Dimensions&gt;
                      &lt;CustomerReferences&gt;2313700&lt;/CustomerReferences&gt;
                  &lt;/RequestedPackages&gt;&lt;/Packages&gt;
          &lt;/RequestedShipment&gt;
      &lt;/shipreq:ShipmentRequest&gt;
  </code></pre>
  
  <p>I am also putting header as </p>
  
  <pre><code>             &lt;wsse:UsernameToken wsu:Id="Example"&gt;
               &lt;wsse:Username&gt;test&lt;/wsse:Username&gt;
              &lt;wsse:Password Type="wsse:PasswordText"&gt;test1&lt;/wsse:Password&gt;
              &lt;wsu:Created&gt;2020-04-21T14:10:50Z&lt;/wsu:Created&gt;';
              &lt;/wsse:UsernameToken&gt;
  </code></pre>
  
  <p>The URL i am using is 
  <a href="https://wsbexpress.dhl.com:443/sndpt/expressRateBook" rel="nofollow noreferrer">https://wsbexpress.dhl.com:443/sndpt/expressRateBook</a></p>
  
  <p>I am using curl and putting the request and header as </p>
  
  <pre><code>$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
  curl_setopt($ch,CURLOPT_HEADER,true);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $strRequest)
  $result = curl_exec($ch);
  </code></pre>
  
  <p>I am getting response as </p>
  
  <pre><code>HTTP/1.1 100 Continue
  
  HTTP/1.1 500 Internal Server Error
  Date: Tue, 21 Apr 2020 11:18:38 GMT
  Server: 
  Content-Length: 2122
  Connection: close
  X-CorrelationID: Id-8ed69e5e114fd399f8bb6d1d 0
  Accept: */*
  ClientSide: 202.47.35.205
  Content-Type: application/x-www-form-urlencoded
  Set-Cookie: BIGipServer~WSB~pl_wsb-express-chd.dhl.com_443=292047013.64288.0000; path=/; Httponly; Secure
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ShipmentRequest xsi:noNamespaceSchemaLocation="ShipmentMsgRequest.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;shipreq:ShipmentRequest&gt;
          &lt;RequestedShipment&gt;
              &lt;ShipmentInfo&gt;
                  &lt;DropOffType&gt;REGULAR_PICKUP&lt;/DropOffType&gt;
                  &lt;ServiceType&gt;U&lt;/ServiceType&gt;
                  &lt;Account&gt;12345&lt;/Account&gt;
                  &lt;Currency&gt;USD&lt;/Currency&gt;
                  &lt;UnitOfMeasurement&gt;SI&lt;/UnitOfMeasurement&gt;
                  &lt;PackagesCount &gt;1&lt;/PackagesCount&gt;
                  &lt;LabelType&gt;PDF&lt;/LabelType&gt;
                  &lt;LabelTemplate&gt;ECOM26_84_001&lt;/LabelTemplate&gt;
              &lt;/ShipmentInfo&gt;
              &lt;ShipTimestamp&gt;&lt;/ShipTimestamp&gt;
              &lt;PaymentInfo&gt;DAP&lt;/PaymentInfo&gt;
              &lt;InternationalDetail&gt;
                  &lt;Commodities&gt;
                      &lt;NumberOfPieces&gt;1&lt;/NumberOfPieces&gt;
                      &lt;Description&gt;1&lt;/Description&gt;
                      &lt;Quantity&gt;1&lt;/Quantity&gt;
                      &lt;CustomsValue&gt;1.00&lt;/CustomsValue&gt;
                  &lt;/Commodities&gt;
                  &lt;Content&gt;1&lt;/Content&gt;
              &lt;/InternationalDetail&gt;
              &lt;Ship&gt;
                  &lt;Shipper&gt;
                      &lt;Contact&gt;
                          &lt;PersonName&gt;test&lt;/PersonName&gt;
                          &lt;CompanyName&gt;test1&lt;/CompanyName&gt;
                          &lt;PhoneNumber&gt;34324324&lt;/PhoneNumber&gt;
                      &lt;/Contact&gt;
                      &lt;Address&gt;
                          &lt;StreetLines&gt;address test/StreetLines&gt;
                          &lt;City&gt;Singapore&lt;/City&gt;
                          &lt;PostalCode&gt;343333&lt;/PostalCode&gt;
                          &lt;CountryCode&gt;SG&lt;/CountryCode&gt;
                      &lt;/Address&gt;
                  &lt;/Shipper&gt;
                  &lt;Recipient&gt;
                      &lt;Contact&gt;
                          &lt;PersonName&gt;John&lt;/PersonName&gt;
                          &lt;CompanyName&gt;ABC Worldwide&lt;/CompanyName&gt;
                          &lt;PhoneNumber&gt;1234567&lt;/PhoneNumber&gt;
                      &lt;/Contact&gt;
                      &lt;Address&gt;
                          &lt;StreetLines&gt;Private Bag 92019.Auckland Mail Centre.&lt;/StreetLines&gt;
                          &lt;City&gt;Auckland&lt;/City&gt;
                          &lt;PostalCode&gt;1011&lt;/PostalCode&gt;
                          &lt;CountryCode&gt;NZ&lt;/CountryCode&gt;
                      &lt;/Address&gt;
                  &lt;/Recipient&gt;
              &lt;/Ship&gt;
              &lt;Packages&gt;&lt;RequestedPackages number=1&gt;
                      &lt;InsuredValue&gt;1.00&lt;/InsuredValue&gt;
                      &lt;Weight&gt;1.00&lt;/Weight&gt;
                      &lt;Dimensions&gt;
                          &lt;Length&gt;1&lt;/Length&gt;
                          &lt;Width&gt;1&lt;/Width&gt;
                          &lt;Height&gt;1&lt;/Height&gt;
                      &lt;/Dimensions&gt;
                      &lt;CustomerReferences&gt;2313700&lt;/CustomerReferences&gt;
                  &lt;/RequestedPackages&gt;&lt;/Packages&gt;
          &lt;/RequestedShipment&gt;
      &lt;/shipreq:ShipmentRequest&gt;
  </code></pre>
  
  <hr>
  
  <p>I even tried using the Soap class using the request below</p>
  
  <pre><code>$request=&lt;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"&gt;
     &lt;soap:Header&gt;&lt;wsse:Security soapenv:mustunderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-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; test&lt;/wsse:Username &gt;           
              &lt;wsse:Password type = "PasswordText" &gt;test&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; 2020 - 04 - 24 20:17:21 &lt;/wsu:Created &gt;
           &lt;/wsse:UsernameToken &gt;
        &lt;/wsse:Security &gt;
  &lt;/soap:Header&gt;
     &lt;soap:Body&gt;
        &lt;ShipmentRequest xmlns="http://scxgxtt.phx-dc.dhl.com/euExpressRateBook/ShipmentMsgRequest"&gt;
           &lt;MessageId xmlns=""&gt;c68d7150bbd611e2b09ad103c98eed12&lt;/MessageId&gt;
           &lt;ClientDetail xmlns=""/&gt;
           &lt;RequestedShipment xmlns=""&gt;
              &lt;ShipmentInfo&gt;
                 &lt;DropOffType&gt;REGULAR_PICKUP&lt;/DropOffType&gt;
                 &lt;ServiceType&gt;P&lt;/ServiceType&gt;
                 &lt;Account&gt;4324324324&lt;/Account&gt;
                 &lt;Currency&gt;EUR&lt;/Currency&gt;
                 &lt;UnitOfMeasurement&gt;SI&lt;/UnitOfMeasurement&gt;
              &lt;/ShipmentInfo&gt;
              &lt;ShipTimestamp&gt;2019-10-24T14:01:22GMT+00:00&lt;/ShipTimestamp&gt;
              &lt;PaymentInfo&gt;DDU&lt;/PaymentInfo&gt;
              &lt;InternationalDetail&gt;
                 &lt;Commodities&gt;
                    &lt;NumberOfPieces&gt;1&lt;/NumberOfPieces&gt;
                    &lt;Description&gt;Documents&lt;/Description&gt;
                    &lt;CustomsValue&gt;10&lt;/CustomsValue&gt;
                    &lt;CountryOfManufacture&gt;ES&lt;/CountryOfManufacture&gt;
                 &lt;/Commodities&gt;
              &lt;/InternationalDetail&gt;
              &lt;Ship&gt;
                 &lt;Shipper&gt;
                    &lt;Contact&gt;
                       &lt;PersonName&gt;Karlos Espana&lt;/PersonName&gt;
                       &lt;CompanyName&gt;SHIPING LTD&lt;/CompanyName&gt;
                       &lt;PhoneNumber&gt;3848211&lt;/PhoneNumber&gt;
                    &lt;/Contact&gt;
                    &lt;Address&gt;
                       &lt;StreetLines&gt;DEL STREETO 9&lt;/StreetLines&gt;
                       &lt;City&gt;SANT CUGAT DEL VALLES&lt;/City&gt;
                       &lt;PostalCode&gt;08173&lt;/PostalCode&gt;
                       &lt;CountryCode&gt;ES&lt;/CountryCode&gt;
                    &lt;/Address&gt;
                 &lt;/Shipper&gt;
                 &lt;Recipient&gt;
                    &lt;Contact&gt;
                       &lt;PersonName&gt;Martin Soltys&lt;/PersonName&gt;
                       &lt;CompanyName&gt;DHL&lt;/CompanyName&gt;
                       &lt;PhoneNumber&gt;731731731&lt;/PhoneNumber&gt;
                    &lt;/Contact&gt;
                    &lt;Address&gt;
                       &lt;StreetLines&gt;V Parku 2308/10&lt;/StreetLines&gt;
                       &lt;City&gt;Prague&lt;/City&gt;
                       &lt;PostalCode&gt;14800&lt;/PostalCode&gt;
                       &lt;CountryCode&gt;CZ&lt;/CountryCode&gt;
                    &lt;/Address&gt;
                 &lt;/Recipient&gt;
              &lt;/Ship&gt;
              &lt;Packages&gt;
                 &lt;RequestedPackages number="1"&gt;
                    &lt;Weight&gt;1&lt;/Weight&gt;
                    &lt;Dimensions&gt;
                       &lt;Length&gt;35&lt;/Length&gt;
                       &lt;Width&gt;25&lt;/Width&gt;
                       &lt;Height&gt;1&lt;/Height&gt;
                    &lt;/Dimensions&gt;
                    &lt;CustomerReferences&gt;LC MAGIC NUMBER 0037&lt;/CustomerReferences&gt;
                 &lt;/RequestedPackages&gt;
              &lt;/Packages&gt;
           &lt;/RequestedShipment&gt;
        &lt;/ShipmentRequest&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  
  
  
  $url = 'https://wsbexpress.dhl.com:443/sndpt/expressRateBook';
      $action = 'createShipmentRequest';
      try {
          $client = new SoapClient($path_to_wsdl);
          $response =$client-&gt;createShipmentRequest($request);
      } catch (SoapFault $fault) {
          echo "&lt;h2&gt;SOAP Fault!&lt;/h2&gt;&lt;p&gt;";
          echo "FaultCode: {$fault-&gt;faultcode} &lt;br/&gt;";
          echo "FaultString: {$fault-&gt;faultstring} &lt;br/&gt;";
          echo"&lt;/p/&gt;";
      }
  </code></pre>