向TNT API发送标签请求会返回错误9200

时间:2019-01-28 20:43:52

标签: ruby-on-rails xml api

在RoR应用程序上,当我尝试使用TNT API进行预订以发送对标签的请求时,我正在处理哪种图书承运人运输,我遇到以下错误:

Exception: BookingLib::Errors::AwbDocumentFailedException

Error code: awb_xml_failure

Error data:



9200
Issue with validating TNT common systems data

我不知道为什么这么做,这意味着什么。

我的XML:

<?xml version="1.0" encoding="UTF-8"?>
<labelRequest>
  <consignment key="CON1">
    <consignmentIdentity>
      <consignmentNumber>123456782</consignmentNumber>
      <customerReference>Robert's computer</customerReference>
    </consignmentIdentity>
    <collectionDateTime>2008-06-12T13:00:00</collectionDateTime>
    <sender>
      <name><%= transform_to_tnt_char_set(tnt_sender.company_name) %></name>
      <addressLine1><%= transform_to_tnt_char_set(tnt_sender.address_line1) %></addressLine1>
      <addressLine2><%= transform_to_tnt_char_set(tnt_sender.address_line2) %></addressLine2>
      <addressLine3><%= transform_to_tnt_char_set(tnt_sender.address_line3) %></addressLine3>
      <town><%= transform_to_tnt_char_set(tnt_sender.city) %></town>
      <exactMatch>Y</exactMatch>
      <province>Warks</province>
      <postcode><%= transform_to_tnt_char_set(tnt_sender.zip_code) %></postcode>
       <country><%= transform_to_tnt_char_set(tnt_sender.country_code) %></country>
    </sender>
    <delivery>
       <name><%= transform_to_tnt_char_set(tnt_recipient.company_name) %></name>
       <addressLine1><%= transform_to_tnt_char_set(tnt_recipient.address_line1) %></addressLine1>
       <addressLine2><%= transform_to_tnt_char_set(tnt_recipient.address_line2) %></addressLine2>
       <town><%= transform_to_tnt_char_set(tnt_recipient.city) %></town>
       <exactMatch>Y</exactMatch>
       <province/>
       <postcode><%= transform_to_tnt_char_set(tnt_recipient.zip_code) %></postcode>
       <country><%= transform_to_tnt_char_set(tnt_recipient.country_code) %></country>
    </delivery>
    <product>
      <lineOfBusiness>2</lineOfBusiness>
      <groupId>0</groupId>
      <subGroupId>0</subGroupId>
      <id>EX</id>
      <type>N</type>
      <option>PR</option>
    </product>
    <account>
      <accountNumber>100445</accountNumber>
      <accountCountry>GB</accountCountry>
    </account>
    <totalNumberOfPieces>3</totalNumberOfPieces>
    <pieceLine>
    <identifier>1</identifier>
    <goodsDescription>piecelinegoods desc</goodsDescription>
    <pieceMeasurements>
      <length>1.11</length>
      <width>1.11</width>
      <height>1.11</height>
      <weight>1.11</weight>
    </pieceMeasurements>
    <pieces>
      <sequenceNumbers>1,2</sequenceNumbers>
      <pieceReference>keyboard and mouse</pieceReference>
    </pieces>
    <pieces>
      <sequenceNumbers>3</sequenceNumbers>
      <pieceReference>computer tower</pieceReference>
    </pieces>
    </pieceLine>
  </consignment>
</labelRequest>

预订将调用API来获取带有XML参数的标签,并应显示为可打印。但是,相反,我收到了我无法理解的错误9200。

如果需要更多代码,我可以要求编辑我的问题。

Rendered XML
<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n
<labelRequest>\n  
    <consignment key=\"CON1\">\n    
        <consignmentIdentity>\n      
            <consignmentNumber>123456782</consignmentNumber>\n      
            <customerReference>Robert's computer</customerReference>\n    
        </consignmentIdentity>\n    
        <collectionDateTime>2008-06-12T13:00:00</collectionDateTime>\n    
        <sender>\n      
            <name>HeyHO</name>\n      
            <addressLine1>Sollerodgade 25,3</addressLine1>\n      
            <addressLine2></addressLine2>\n      
            <addressLine3></addressLine3>\n      
            <town>Kobenhavn N</town>\n      
            <exactMatch>Y</exactMatch>\n      
            <province>Warks</province>\n      
            <postcode>2200</postcode>\n       
            <country>dk</country>\n    
        </sender>\n    
        <delivery>\n       
            <name>Customer B</name>\n       
            <addressLine1>Sollerodgade 25,3</addressLine1>\n       
            <addressLine2></addressLine2>\n       
            <town>Kobenhavn N</town>\n       
            <exactMatch>Y</exactMatch>\n       
            <province/>\n       
            <postcode>2200</postcode>\n       
            <country>dk</country>\n    
        </delivery>\n    
        <product>\n      
            <lineOfBusiness>2</lineOfBusiness>\n      
            <groupId>0</groupId>\n      
            <subGroupId>0</subGroupId>\n      
            <id>EX</id>\n      
            <type>N</type>\n      
            <option>PR</option>\n    
        </product>\n    
        <account>\n      
            <accountNumber>100445</accountNumber>\n      
            <accountCountry>GB</accountCountry>\n    
        </account>\n    
        <totalNumberOfPieces>3</totalNumberOfPieces>\n    
        <pieceLine>\n    
            <identifier>1</identifier>\n    
            <goodsDescription>piecelinegoods desc</goodsDescription>\n    
            <pieceMeasurements>\n      
                <length>1.11</length>\n      
                <width>1.11</width>\n      
                <height>1.11</height>\n      
                <weight>1.11</weight>\n    
            </pieceMeasurements>\n    
            <pieces>\n      
                <sequenceNumbers>1,2</sequenceNumbers>\n      
                <pieceReference>keyboard and mouse</pieceReference>\n    
            </pieces>\n    
            <pieces>\n      
                <sequenceNumbers>3</sequenceNumbers>\n      
                <pieceReference>computer tower</pieceReference>\n    
            </pieces>\n    
        </pieceLine>\n  
    </consignment>\n
</labelRequest>"
(byebug) label_request_xml
"
<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n
<labelRequest>\n  
    <consignment key=\"CON1\">\n    
        <consignmentIdentity>\n      
            <consignmentNumber>123456782</consignmentNumber>\n      
            <customerReference>Robert's computer</customerReference>\n    
        </consignmentIdentity>\n    
        <collectionDateTime>2008-06-12T13:00:00</collectionDateTime>\n    
        <sender>\n      
            <name>HeyHO</name>\n      
            <addressLine1>Sollerodgade 25,3</addressLine1>\n      
            <addressLine2></addressLine2>\n      
            <addressLine3></addressLine3>\n      
            <town>Kobenhavn N</town>\n      
            <exactMatch>Y</exactMatch>\n      
            <province>Warks</province>\n      
            <postcode>2200</postcode>\n       
            <country>dk</country>\n    
        </sender>\n    
        <delivery>\n       
            <name>Customer B</name>\n       
            <addressLine1>Sollerodgade 25,3</addressLine1>\n       
            <addressLine2></addressLine2>\n       
            <town>Kobenhavn N</town>\n       
            <exactMatch>Y</exactMatch>\n       
            <province/>\n       
            <postcode>2200</postcode>\n       
            <country>dk</country>\n    
        </delivery>\n    
        <product>\n      
            <lineOfBusiness>2</lineOfBusiness>\n      
            <groupId>0</groupId>\n      
            <subGroupId>0</subGroupId>\n      
            <id>EX</id>\n      
            <type>N</type>\n      
            <option>PR</option>\n    
        </product>\n    
        <account>\n      
            <accountNumber>100445</accountNumber>\n      
            <accountCountry>GB</accountCountry>\n    
        </account>\n    
        <totalNumberOfPieces>3</totalNumberOfPieces>\n    
        <pieceLine>\n    
            <identifier>1</identifier>\n    
            <goodsDescription>piecelinegoods desc</goodsDescription>\n    
            <pieceMeasurements>\n      
                <length>1.11</length>\n      
                <width>1.11</width>\n      
                <height>1.11</height>\n      
                <weight>1.11</weight>\n    
            </pieceMeasurements>\n    
            <pieces>\n      
                <sequenceNumbers>1,2</sequenceNumbers>\n      
                <pieceReference>keyboard and mouse</pieceReference>\n    
            </pieces>\n    
            <pieces>\n      
                <sequenceNumbers>3</sequenceNumbers>\n      
                <pieceReference>computer tower</pieceReference>\n    
            </pieces>\n    
        </pieceLine>\n  
    </consignment>\n
</labelRequest>

1 个答案:

答案 0 :(得分:1)

您需要更改业务行号(行从 <lineOfBusiness>2</lineOfBusiness><lineOfBusiness>1</lineOfBusiness>
国内dk转dk应为“1”。 2为国际非国内转...