DivideBV / Postnl

Library to connect to PostNL's SOAP service called CIF
GNU General Public License v2.0
31 stars 40 forks source link

Errors in Confirming #63

Closed ameenross closed 6 years ago

ameenross commented 6 years ago

I have a domestic 3089 shipment. The request works in the old CIF environment, but the environment with the new AUTH is broken. I get these errors:

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <s:Fault>
      <faultcode>s:CIF Framework Message Interceptor</faultcode>
      <faultstring xml:lang="en-US">Check CIFException in the detail section</faultstring>
      <detail>
        <CifException xmlns="http://postnl.nl/cif/services/common/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <Errors>
            <ExceptionData>
              <Description i:nil="true"/>
              <ErrorMsg>Required parameter 'Customer.Address.AddressType' is missing.</ErrorMsg>
              <ErrorNumber>4</ErrorNumber>
            </ExceptionData>
            <ExceptionData>
              <Description i:nil="true"/>
              <ErrorMsg>Required parameter 'Customer.Address.City' is missing.</ErrorMsg>
              <ErrorNumber>4</ErrorNumber>
            </ExceptionData>
            <ExceptionData>
              <Description i:nil="true"/>
              <ErrorMsg>Required parameter 'Customer.Address.Countrycode' is missing.</ErrorMsg>
              <ErrorNumber>4</ErrorNumber>
            </ExceptionData>
            <ExceptionData>
              <Description i:nil="true"/>
              <ErrorMsg>Required parameter 'Shipments.Shipment.0.Customs.HandleAsNonDeliverable' is missing.</ErrorMsg>
              <ErrorNumber>4</ErrorNumber>
            </ExceptionData>
            <ExceptionData>
              <Description i:nil="true"/>
              <ErrorMsg>Required parameter 'Shipments.Shipment.0.Customs.ShipmentType' is missing.</ErrorMsg>
              <ErrorNumber>4</ErrorNumber>
            </ExceptionData>
            <ExceptionData>
              <Description i:nil="true"/>
              <ErrorMsg>Required parameter 'Shipments.Shipment.0.Customs.Currency' is missing.</ErrorMsg>
              <ErrorNumber>4</ErrorNumber>
            </ExceptionData>
            <ExceptionData>
              <Description i:nil="true"/>
              <ErrorMsg>Required parameter 'Shipments.Shipment.0.Customs.Content' is missing.</ErrorMsg>
              <ErrorNumber>4</ErrorNumber>
            </ExceptionData>
          </Errors>
        </CifException>
      </detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

The funny thing is that it complains about customs for a shipment within NL.

slokhorst commented 6 years ago

Does the example from README.md work for you?

Works fine for me with "dividebv/postnl": "dev-master" (ffe35d5) using that exact example and just changing the credentials.

Edit: the same example still works if I change the product code from 3085 to 3089.

ameenross commented 6 years ago

That is the generateLabel call. That still works, which is even stranger because that call is nearly identical to the confirm call.

Here's the raw request (address fictionalized):

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://postnl.nl/cif/domain/ConfirmingWebService/" xmlns:ns2="http://postnl.nl/cif/services/ConfirmingWebService/">
  <SOAP-ENV:Body>
    <ns2:Confirming>
      <ns1:Customer>
        <ns1:Address xsi:nil="true"/>
        <ns1:CollectionLocation>1234</ns1:CollectionLocation>
        <ns1:ContactPerson xsi:nil="true"/>
        <ns1:CustomerCode>ABCD</ns1:CustomerCode>
        <ns1:CustomerNumber>123456</ns1:CustomerNumber>
        <ns1:Email xsi:nil="true"/>
        <ns1:Name xsi:nil="true"/>
      </ns1:Customer>
      <ns1:Message>
        <ns1:MessageID>1</ns1:MessageID>
        <ns1:MessageTimeStamp>02-10-2018 10:00:00</ns1:MessageTimeStamp>
      </ns1:Message>
      <ns1:Shipments>
        <ns1:Shipment>
          <ns1:Addresses>
            <ns1:Address>
              <ns1:AddressType>01</ns1:AddressType>
              <ns1:Area xsi:nil="true"/>
              <ns1:Buildingname xsi:nil="true"/>
              <ns1:City>Ons Dorp</ns1:City>
              <ns1:CompanyName>Some Company BV</ns1:CompanyName>
              <ns1:Countrycode>NL</ns1:Countrycode>
              <ns1:Department xsi:nil="true"/>
              <ns1:Doorcode xsi:nil="true"/>
              <ns1:FirstName>Henk</ns1:FirstName>
              <ns1:Floor xsi:nil="true"/>
              <ns1:HouseNr>1</ns1:HouseNr>
              <ns1:HouseNrExt xsi:nil="true"/>
              <ns1:Name>Henkszoon</ns1:Name>
              <ns1:Region xsi:nil="true"/>
              <ns1:Remark xsi:nil="true"/>
              <ns1:Street>Hoofdstraat</ns1:Street>
              <ns1:StreetHouseNrExt xsi:nil="true"/>
              <ns1:Zipcode>1234 AB</ns1:Zipcode>
            </ns1:Address>
            <ns1:Address>
              <ns1:AddressType>02</ns1:AddressType>
              <ns1:Area xsi:nil="true"/>
              <ns1:Buildingname xsi:nil="true"/>
              <ns1:City>Ons Dorp</ns1:City>
              <ns1:CompanyName/>
              <ns1:Countrycode>NL</ns1:Countrycode>
              <ns1:Department xsi:nil="true"/>
              <ns1:Doorcode xsi:nil="true"/>
              <ns1:FirstName>Verzender</ns1:FirstName>
              <ns1:Floor xsi:nil="true"/>
              <ns1:HouseNr>1</ns1:HouseNr>
              <ns1:HouseNrExt/>
              <ns1:Name>Verzender</ns1:Name>
              <ns1:Region xsi:nil="true"/>
              <ns1:Remark xsi:nil="true"/>
              <ns1:Street>Plein</ns1:Street>
              <ns1:StreetHouseNrExt xsi:nil="true"/>
              <ns1:Zipcode>1234AZ</ns1:Zipcode>
            </ns1:Address>
          </ns1:Addresses>
          <ns1:Amounts xsi:nil="true"/>
          <ns1:Barcode>3S12354698</ns1:Barcode>
          <ns1:CollectionTimeStampEnd xsi:nil="true"/>
          <ns1:CollectionTimeStampStart xsi:nil="true"/>
          <ns1:Contacts xsi:nil="true"/>
          <ns1:Content xsi:nil="true"/>
          <ns1:CostCenter xsi:nil="true"/>
          <ns1:CustomerOrderNumber xsi:nil="true"/>
          <ns1:Customs xsi:nil="true"/>
          <ns1:DeliveryAddress xsi:nil="true"/>
          <ns1:DeliveryDate xsi:nil="true"/>
          <ns1:Dimension>
            <ns1:Height xsi:nil="true"/>
            <ns1:Length xsi:nil="true"/>
            <ns1:Volume xsi:nil="true"/>
            <ns1:Weight>0</ns1:Weight>
            <ns1:Width xsi:nil="true"/>
          </ns1:Dimension>
          <ns1:DownPartnerBarcode xsi:nil="true"/>
          <ns1:DownPartnerID xsi:nil="true"/>
          <ns1:DownPartnerLocation xsi:nil="true"/>
          <ns1:Groups xsi:nil="true"/>
          <ns1:IDExpiration xsi:nil="true"/>
          <ns1:IDNumber xsi:nil="true"/>
          <ns1:IDType xsi:nil="true"/>
          <ns1:ProductCodeCollect xsi:nil="true"/>
          <ns1:ProductCodeDelivery>3089</ns1:ProductCodeDelivery>
          <ns1:ProductOptions xsi:nil="true"/>
          <ns1:ReceiverDateOfBirth xsi:nil="true"/>
          <ns1:Reference>xxxx</ns1:Reference>
          <ns1:ReferenceCollect xsi:nil="true"/>
          <ns1:Remark xsi:nil="true"/>
          <ns1:ReturnBarcode xsi:nil="true"/>
          <ns1:ReturnReference xsi:nil="true"/>
        </ns1:Shipment>
      </ns1:Shipments>
    </ns2:Confirming>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope> 
ameenross commented 6 years ago

I've received a response from PostNL about my inquiry. I've got this in my request:

<ns1:Address xsi:nil="true"/>

This means there is no address. But the CIF service interprets it such that since I've given an address element, it should have the properties that are required for the address element. They don't seem to care about the xsi:nil="true". Even though this is in their WSDL:

<xs:element minOccurs="0" name="Address" nillable="true" type="tns:Address"/>

So their reasoning doesn't make any sense. Also, this exact request works in the old environment.