netresearch / dhl-shipping-m2

DHL multi-division shipping extension for Magento 2
Open Software License 3.0
13 stars 4 forks source link

Soap Error 'Error Fetching http headers' not visible in admin backend while label created successfully #18

Closed HenKun closed 3 years ago

HenKun commented 3 years ago

We faced an issue, where the DHL Soap Server did not responded correctly or in time (I guess so), when a label was requested.

The error was logged, however, not visible in backend, which led to confusion:

What happened:

Images of Magento Backend

grafik grafik

Log of the first failed attempt

[2020-12-22 13:34:41] dhlpaket.ERROR: POST /services/production/soap HTTP/1.1
Host: cig.dhl.de
Connection: Keep-Alive
User-Agent: PHP-SOAP/7.3.24
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:createShipmentOrder"
Content-Length: 1855
Authorization: Basic [hidden]

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://dhl.de/webservice/cisbase" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://dhl.de/webservices/businesscustomershipping/3.0"><SOAP-ENV:Header><ns1:Authentification><ns1:user>[hidden]</ns1:user><ns1:signature>[hidden]</ns1:signature></ns1:Authentification></SOAP-ENV:Header><SOAP-ENV:Body><ns2:CreateShipmentOrderRequest><Version xsi:type="ns1:Version"><ns1:majorRelease>3</ns1:majorRelease><ns1:minorRelease>0</ns1:minorRelease></Version><ShipmentOrder><sequenceNumber>0</sequenceNumber><Shipment><ShipmentDetails><product>V53WPAK</product><ns1:accountNumber>[hidden]</ns1:accountNumber><customerReference>YY</customerReference><shipmentDate>2020-12-23</shipmentDate><ShipmentItem><weightInKG>0.36</weightInKG></ShipmentItem></ShipmentDetails><Shipper><Name><ns1:name1>xx</ns1:name1></Name><Address><ns1:streetName>xx</ns1:streetName><ns1:streetNumber>15</ns1:streetNumber><ns1:zip>06120</ns1:zip><ns1:city>Halle (Saale)</ns1:city><ns1:province>SAC</ns1:province><ns1:Origin><ns1:countryISOCode>DE</ns1:countryISOCode></ns1:Origin></Address><Communication/></Shipper><Receiver><ns1:name1>xx</ns1:name1><Address><ns1:name2></ns1:name2><ns1:streetName>52/xx</ns1:streetName><ns1:streetNumber></ns1:streetNumber><ns1:addressAddition></ns1:addressAddition><ns1:zip>eh530dn</ns1:zip><ns1:city>east calder</ns1:city><ns1:province></ns1:province><ns1:Origin><ns1:countryISOCode>GB</ns1:countryISOCode></ns1:Origin></Address><Communication/></Receiver></Shipment><PrintOnlyIfCodeable active="1"/></ShipmentOrder><labelResponseType>B64</labelResponseType></ns2:CreateShipmentOrderRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
 [] []
[2020-12-22 13:34:41] dhlpaket.ERROR: HTTP/1.1 200 OK
Date: Tue, 22 Dec 2020 13:34:40 GMT
Server: WebServer
Strict-Transport-Security: max-age=63072000; includeSubdomains; preload
X-XSS-Protection: 1; mode=block
X-DNS-Prefetch-Control: off
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: default-src 'none'; script-src 'none'; frame-src 'none'; object-src 'none'
Content-Type: text/xml;charset=utf-8
Content-Length: 1409
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive

<soap:Envelope xmlns:bcs="http://dhl.de/webservices/businesscustomershipping/3.0" xmlns:cis="http://dhl.de/webservice/cisbase" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Header/>
   <soap:Body>
      <bcs:CreateShipmentOrderResponse>
         <bcs:Version>
            <majorRelease>3</majorRelease>
            <minorRelease>0</minorRelease>
         </bcs:Version>
         <Status>
            <statusCode>1101</statusCode>
            <statusText>Hard validation error occured.</statusText>
         </Status>
         <CreationState>
            <sequenceNumber>0</sequenceNumber>
            <LabelData>
               <Status>
                  <statusCode>1101</statusCode>
                  <statusText>Hard validation error occured.</statusText>
                  <statusMessage>Bitte geben Sie eine Hausnummer an.</statusMessage>
                  <statusMessage>Es handelt sich um eine ungültige Postleitzahl. Bitte verwenden Sie eine britisches Format: AA9A 9AA, A9A 9AA, A9 9AA, A99 9AA, AA9 9AA oder AA99 9AA. Es ist dennoch möglich, einen Versandschein zu drucken.</statusMessage>
                  <statusMessage>Bitte geben Sie eine Hausnummer an.</statusMessage>
               </Status>
            </LabelData>
         </CreationState>
      </bcs:CreateShipmentOrderResponse>
   </soap:Body>
</soap:Envelope> [] []
[2020-12-22 13:34:41] dhlpaket.ERROR: Hard validation error occured. Bitte geben Sie eine Hausnummer an. Es handelt sich um eine ungültige Postleitzahl. Bitte verwenden Sie eine britisches Format: AA9A 9AA, A9A 9AA, A9 9AA, A99 9AA, AA9 9AA oder AA99 9AA. Es ist dennoch möglich, einen Versandschein zu drucken. [] []

Log of the second attempt

[2020-12-22 13:38:48] dhlpaket.ERROR: POST /services/production/soap HTTP/1.1
Host: cig.dhl.de
Connection: Keep-Alive
User-Agent: PHP-SOAP/7.3.24
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:createShipmentOrder"
Content-Length: 1854
Authorization: Basic [hidden]

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://dhl.de/webservice/cisbase" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://dhl.de/webservices/businesscustomershipping/3.0"><SOAP-ENV:Header><ns1:Authentification><ns1:user>[hidden]</ns1:user><ns1:signature>[hidden]</ns1:signature></ns1:Authentification></SOAP-ENV:Header><SOAP-ENV:Body><ns2:CreateShipmentOrderRequest><Version xsi:type="ns1:Version"><ns1:majorRelease>3</ns1:majorRelease><ns1:minorRelease>0</ns1:minorRelease></Version><ShipmentOrder><sequenceNumber>0</sequenceNumber><Shipment><ShipmentDetails><product>V53WPAK</product><ns1:accountNumber>[hidden]</ns1:accountNumber><customerReference>YY</customerReference><shipmentDate>2020-12-23</shipmentDate><ShipmentItem><weightInKG>0.36</weightInKG></ShipmentItem></ShipmentDetails><Shipper><Name><ns1:name1>XX</ns1:name1></Name><Address><ns1:streetName>xx</ns1:streetName><ns1:streetNumber>15</ns1:streetNumber><ns1:zip>06120</ns1:zip><ns1:city>Halle (Saale)</ns1:city><ns1:province>SAC</ns1:province><ns1:Origin><ns1:countryISOCode>DE</ns1:countryISOCode></ns1:Origin></Address><Communication/></Shipper><Receiver><ns1:name1>xx</ns1:name1><Address><ns1:name2></ns1:name2><ns1:streetName>xx</ns1:streetName><ns1:streetNumber>52</ns1:streetNumber><ns1:addressAddition></ns1:addressAddition><ns1:zip>eh530dn</ns1:zip><ns1:city>east calder</ns1:city><ns1:province></ns1:province><ns1:Origin><ns1:countryISOCode>GB</ns1:countryISOCode></ns1:Origin></Address><Communication/></Receiver></Shipment><PrintOnlyIfCodeable active="1"/></ShipmentOrder><labelResponseType>B64</labelResponseType></ns2:CreateShipmentOrderRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
 [] []
[2020-12-22 13:38:48] dhlpaket.ERROR: 
 [] []
[2020-12-22 13:38:48] dhlpaket.ERROR: Error Fetching http headers [] []

Proposed solution

mam08ixo commented 3 years ago

Hi @HenKun

that is a tricky situation here. Most likely, the label creation succeeded in the DHL systems but the (positive) response was not received in time.

Based on such an empty response, we cannot make assumptions about the "actual" progress of shipment order processing in the remote systems. From the module perspective, anything but a positive response indicates a failure.

When the shipping label is created manually through the packaging popup, then no error comments are added because the admin user receives immediate feedback in the UI. When the shipping label is created automatically (cron or bulk), then a generic error is added to the order/shipment comments in such cases:

Label could not be created: Web service request failed.

Maybe this is sufficient to watch out for possibly affected shipment orders – if it is worth the effort.

HenKun commented 3 years ago

Hello @mam08ixo ,

yes, I see the issue. Maybe it would be a little improvement if in such cases the error messages are more specific, so that the non-technical packing worker knows what could have happened:

1) On bulk or cron processes: Comment to the shipment: "Web service request failed. A label might have been created, please go to DHL Business Portal. "

2) On manual processes: UI Message: "Web service request failed. A label might have been created, please go to DHL Business Portal. ", Additionally a note/comment to the shipment would also be of benefit for future reference.

ngolatka commented 3 years ago

@HenKun That does actually make sense. I've looked through some older support cases and found (after some digging) that this can indeed happen. We're going to change the error message and documentation accordingly.

Internal ref: DHLGW-1049

mam08ixo commented 3 years ago

Error message and documentation were updated with the 1.5.1 release.