karrioapi / karrio

Programmable Shipping API (self-hosted)

Home Page:https://karrio.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[DHL-Conflict] Pickup xml request issue

MrWorld opened this issue · comments

We have been using DHL's services, but we have encountered a problem with the pickup (proxy) request.

The problem seems to be related to the XML request that is being generated by the Karrio system. When we attempt to send a pickup request to DHL using the generated XML, we receive an error response from DHL stating that the XML is incorrect or contains invalid properties.

I have taken the time to investigate the issue further, and I have identified that the problem lies within the XML request being generated. After some debugging, I tried manually creating an XML request with fixed properties, and to my surprise, it worked perfectly fine. This leads me to believe that there might be an issue with the way Karrio service is generating the XML for the pickup request. (we're using same DTO from karrio api docs)

Here is an example of the XML request generated by the Karrio server: (copied from dashboard logs)

note: x characters is not the real values, it just masked

<req:BookPURequest xmlns:req="http://www.dhl.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dhl.com/ book-pickup-global-req_EA.xsd" schemaVersion="3.0">
    <Request>
        <ServiceHeader>
            <MessageTime>2023-08-01T11:38:37</MessageTime>
            <MessageReference>xxxxxxxxxxxxxxxxxxxxxxxxxx</MessageReference>
            <SiteID>xxxxxxxxxxxxxxxxx</SiteID>
            <Password>xxxxxxxxxx</Password>
        </ServiceHeader>
        <MetaData>
            <SoftwareName>XMLPI</SoftwareName>
            <SoftwareVersion>3.0</SoftwareVersion>
        </MetaData>
    </Request>
    <RegionCode>AP</RegionCode>
    <Requestor>
        <AccountType>D</AccountType>
        <AccountNumber>xxxxxxxxxx</AccountNumber>
        <RequestorContact>
            <PersonName>xxxxxxxxxx xxxxxxxx</PersonName>
            <Phone>+xxx xxxx xxx</Phone>
        </RequestorContact>
        <CompanyName>xxxxxxxxxxxxxxxx</CompanyName>
    </Requestor>
    <Place>
        <CompanyName>xxxxxxxxxxx</CompanyName>
        <City>xxxxxxx</City>
        <CountryCode>KW</CountryCode>
        <PostalCode>00965</PostalCode>
    </Place>
    <Pickup>
        <PickupDate>2023-08-01</PickupDate>
        <ReadyByTime>08:00</ReadyByTime>
        <CloseTime>21:00</CloseTime>
        <Pieces>2</Pieces>
        <RemotePickupFlag>Y</RemotePickupFlag>
        <weight>
            <Weight>1.91</Weight>
            <WeightUnit>K</WeightUnit>
        </weight>
        <SpecialInstructions>Handle with care.</SpecialInstructions>
    </Pickup>
    <PickupContact>
        <PersonName>xxxxxxxx xxxxxxx</PersonName>
        <Phone>+xxx xxxx xxxx</Phone>
    </PickupContact>
</req:BookPURequest>

And here is the error response we receive from DHL:

<?xml version="1.0" encoding="UTF-8"?>
<res:ErrorResponse xmlns:res='http://www.dhl.com/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation= 'http://www.dhl.com/ err-res.xsd'>
    <Response>
        <ServiceHeader>
            <MessageTime>2023-08-01T11:38:37.830+00:00</MessageTime>
            <MessageReference>xxxxxxxxxxxxxxxx</MessageReference>
            <SiteID>xxxxxxxxxxx</SiteID>
        </ServiceHeader>
        <Status>
            <ActionStatus>Error</ActionStatus>
            <Condition>
                <ConditionCode>111</ConditionCode>
                <ConditionData>Error in parsing request XML:Error: The content of element type &quot;Requestor&quot; is
                    incomplete, it must match
                    &quot;(AccountType,AccountNumber,RequestorContact,CompanyName?,Address1,Address2?,Address3?,City,CountryCode,DivisionName?,PostalCode?)&quot;.
                    at line 23, column 18</ConditionData>
            </Condition>
        </Status>
    </Response>
</res:ErrorResponse>

And here is manual XML request generation based on DHL document(fix version)

<req:BookPURequest xmlns:req="http://www.dhl.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dhl.com/ book-pickup-global-req_EA.xsd" schemaVersion="3.0">
    <Request>
        <ServiceHeader>
            <MessageTime>2023-08-01T10:30:48</MessageTime>
            <MessageReference>xxxxxxxxxxxxxxxxxxxxxxxxxx</MessageReference>
            <SiteID>xxxxxxxx</SiteID>
            <Password>xxxxxxxxxx</Password>
        </ServiceHeader>
        <MetaData>
            <SoftwareName>XMLPI</SoftwareName>
            <SoftwareVersion>3.0</SoftwareVersion>
        </MetaData>
    </Request>
    <RegionCode>AP</RegionCode>
    <Requestor>
        <AccountType>D</AccountType>
        <AccountNumber>xxxxxxxx</AccountNumber>
        <RequestorContact>
            <PersonName>xxxx</PersonName>
            <Phone>+xxx xxxx xxx</Phone>
        </RequestorContact>
        <CompanyName>xxxx xxx</CompanyName>
        <Address1>xxxxxxxxxx</Address1>
        <City>xxxxxxx</City>
        <CountryCode>xx</CountryCode>
    </Requestor>
    <Place>
        <LocationType>B</LocationType>
        <CompanyName>xxxx xxx</CompanyName>
        <Address1>xxxxxxxxxx</Address1>
        <PackageLocation>behind the door</PackageLocation>
        <City>xxxxxxx</City>
        <CountryCode>xx</CountryCode>
    </Place>
    <Pickup>
        <PickupDate>2023-08-01</PickupDate>
        <PickupTypeCode>A</PickupTypeCode>
        <ReadyByTime>08:00</ReadyByTime>
        <CloseTime>21:00</CloseTime>
        <weight>
            <Weight>1.91</Weight>
            <WeightUnit>K</WeightUnit>
        </weight>
    </Pickup>
    <PickupContact>
        <PersonName>xxxx</PersonName>
        <Phone>+xxx xxxx xxx</Phone>
    </PickupContact>
</req:BookPURequest>

And here is the DHL XML official example (dhl xml portal documents):

<?xml version="1.0" encoding="UTF-8"?>
<req:BookPURequest xmlns:req="http://www.dhl.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dhl.com/ book-pickup-global-req_EA.xsd" schemaVersion="3.0">
    <Request>
        <ServiceHeader>
            <MessageTime>2017-02-27T11:28:56.000-08:00</MessageTime>
            <MessageReference>1234567890123456789012345678901</MessageReference>
            <SiteID>CustomerSiteID</SiteID>
            <Password>CustomerPassword</Password>
        </ServiceHeader>
        <MetaData>
            <SoftwareName>XMLPI</SoftwareName>
            <SoftwareVersion>3.0</SoftwareVersion>
        </MetaData>
    </Request>
    <Requestor>
        <AccountType>D</AccountType>
        <AccountNumber>123456789</AccountNumber>
        <RequestorContact>
            <PersonName>Roy</PersonName>
            <Phone>1234567890</Phone>
        </RequestorContact>
        <CompanyName>DHL TEST</CompanyName>
        <Address1>DHL EXPRESS FR</Address1>
        <Address2>Le Rue</Address2>
        <City>Paris</City>
        <CountryCode>FR</CountryCode>
        <PostalCode>75001</PostalCode>
    </Requestor>
    <Place>
        <LocationType>B</LocationType>
        <CompanyName>Test Pickup</CompanyName>
        <Address1>DHL EXPRESS GB</Address1>
        <Address2>A Road</Address2>
        <PackageLocation>Reception</PackageLocation>
        <City>LIVERPOOL</City>
        <CountryCode>GB</CountryCode>
        <PostalCode>L24 8RF</PostalCode>
    </Place>
    <Pickup>
        <PickupDate>2018-02-06</PickupDate>
        <PickupTypeCode>A</PickupTypeCode>
        <ReadyByTime>10:20</ReadyByTime>
        <CloseTime>14:20</CloseTime>
        <Pieces>1</Pieces>
        <RemotePickupFlag>Y</RemotePickupFlag>
        <weight>
            <Weight>10</Weight>
            <WeightUnit>K</WeightUnit>
        </weight>
    </Pickup>
    <PickupContact>
        <PersonName>Kosani</PersonName>
        <Phone>1234567890</Phone>
    </PickupContact>
    <ShipmentDetails>
        <AccountType>D</AccountType>
        <AccountNumber>123456789</AccountNumber>
        <BillToAccountNumber>123456789</BillToAccountNumber>
        <AWBNumber>7520067111</AWBNumber>
        <NumberOfPieces>1</NumberOfPieces>
        <Weight>10</Weight>
        <WeightUnit>K</WeightUnit>
        <GlobalProductCode>P</GlobalProductCode>
        <LocalProductCode>P</LocalProductCode>
        <DoorTo>DD</DoorTo>
        <DimensionUnit>C</DimensionUnit>
        <Pieces>
            <Piece>
                <Weight>10</Weight>
                <Width>1</Width>
                <Height>1</Height>
                <Depth>1</Depth>
            </Piece>
        </Pieces>
    </ShipmentDetails>
    <ConsigneeDetails>
        <CompanyName>ConsigneeCompany</CompanyName>
        <AddressLine>ConsigneeAdd1</AddressLine>
        <City>ConsigneeCity</City>
        <CountryCode>FR</CountryCode>
        <PostalCode>75001</PostalCode>
        <Contact>
            <PersonName>ConsigneePerson</PersonName>
            <Phone>12345</Phone>
        </Contact>
    </ConsigneeDetails>
</req:BookPURequest>

I have compared the above XML with the manually created one that works, and I noticed some discrepancies, particularly in the properties and formatting.

Could you kindly review the provided XML request and let us know if you see any issues with it? It's possible that we may be missing certain elements, or there might be some data formatting problems. Any guidance or insight you can provide will be highly appreciated.

If you require any further information or additional code snippets, please don't hesitate to ask. We are eager to resolve this matter promptly to ensure our DHL integration functions flawlessly once again.

Thank you for your attention to this matter. We look forward to your assistance in resolving this issue.

  • OS: Debian
  • Karrio Version: 2023.5 & 2023.5.1 same result