2013-06-12 63 views
1

我是UPS api的新手, 我正在致電ShipmentConfirmRequest到UPS, 這是我發送到wwwcie.ups.com/ups.app的xml格式/ xml/ShipConfirm使用python。UPS:每個貨件需要一個單獨的結算選項

<?xml version="1.0"?> 
      <AccessRequest xml:lang='en-US'> 
       <AccessLicenseNumber>NUMBER</AccessLicenseNumber> 
       <UserId>UUUUU</UserId> 
       <Password>PASSWORD</Password> 
      </AccessRequest> 
      <?xml version="1.0"?> 
      <ShipmentConfirmRequest> 
       <Request> 
        <TransactionReference> 
         <CustomerContext>00001</CustomerContext> 
         <XpciVersion>1.0001</XpciVersion> 
        </TransactionReference> 
        <RequestAction>ShipConfirm</RequestAction> 
        <RequestOption>nonvalidate</RequestOption> 
       </Request> 

       <Shipment> 
        <Description>00001</Description> 
        <!--InvoiceLineTotal> 
         <CurrencyCode>EUR</CurrencyCode> 
         <MonetaryValue>4887</MonetaryValue> 
        </InvoiceLineTotal--> 
        <Shipper> 
         <Name>HELICONIA</Name> 
         <AttentionName>HELICONIA</AttentionName> 
         <Address> 
          <AddressLine1></AddressLine1> 
          <AddressLine2></AddressLine2> 
          <AddressLine3></AddressLine3> 
          <City></City> 
          <StateProvinceCode></StateProvinceCode> 
          <CountryCode></CountryCode> 
          <PostalCode></PostalCode> 
         </Address> 
         <PhoneNumber></PhoneNumber> 
         <ShipperNumber>NUMBER</ShipperNumber> 
         <TaxIdentificationNumber></TaxIdentificationNumber> 
         <FaxNumber></FaxNumber> 
         <EMailAddress></EMailAddress> 
        </Shipper> 
        <ShipTo> 
         <CompanyName>Agriiolait</CompanyName> 
         <AttentionName></AttentionName> 
         <Address> 
          <AddressLine1>Agriiolait</AddressLine1> 
          <AddressLine2>69 rue de Chimay</AddressLine2> 
          <AddressLine3></AddressLine3> 
          <City>Wavre</City> 
          <StateProvinceCode></StateProvinceCode> 
          <CountryCode>BE</CountryCode> 
          <PostalCode></PostalCode> 

         </Address> 
         <PhoneNumber>+32 10 588 558</PhoneNumber> 
         <FaxNumber></FaxNumber> 
         <EMailAddress>[email protected]</EMailAddress> 
         <TaxIdentificationNumber></TaxIdentificationNumber> 
         <LocationID></LocationID> 
        </ShipTo> 
        <Service> 
         <Code>14</Code> 
         <Description>Next Day Air</Description> 
        </Service> 
       </Shipment> 

       <PaymentInformation> 
        <Prepaid> 
         <BillShipper> 
          <AccountNumber>25AC57</AccountNumber> 
         </BillShipper> 
        </Prepaid> 
       </PaymentInformation> 

      <Package> 
       <Description></Description> 
       <PackagingType> 
        <Code>01</Code> 
        <Description>UPS Letter</Description> 
       </PackagingType> 
       <Dimensions> 
        <UnitOfMeasurement> 
         <Code>IN</Code> 
         <Description>Inches</Description> 
        </UnitOfMeasurement> 
        <Length>11.0</Length> 
        <Width>110.0</Width> 
        <Height>11.0</Height> 
       </Dimensions> 
       <PackageWeight> 
        <UnitOfMeasurement> 
         <Code>LBS</Code> 
         <Description>Pounds</Description> 
        </UnitOfMeasurement> 
        <Weight>11.0</Weight> 
       </PackageWeight> 
       <ReferenceNumber> 
        <Code>01</Code> 
        <Value></Value> 
       </ReferenceNumber> 
       <ReferenceNumber> 
        <Code>02</Code> 
        <Value></Value> 
       </ReferenceNumber> 
       <PackageServiceOptions> 
        <InsuredValue> 
         <CurrencyCode>USD</CurrencyCode> 
         <MonetaryValue>975.0</MonetaryValue> 
        </InsuredValue> 
       </PackageServiceOptions> 
      </Package> 


      <LabelSpecification> 
       <LabelPrintMethod> 
        <Code>GIF</Code> 
        <Description>GIF</Description> 
       </LabelPrintMethod> 
       <HTTPUserAgent></HTTPUserAgent> 
       <LabelImageFormat> 
        <Code>GIF</Code> 
       </LabelImageFormat> 
       <LabelStockSize> 
        <Height>8</Height> 
        <Width>8</Width> 
       </LabelStockSize> 
       <LabelImageFormat> 
        <Code>GIF</Code> 
        <Description>GIF</Description> 
       </LabelImageFormat> 
      </LabelSpecification> 
     </ShipmentConfirmRequest> 

但我越來越喜歡

<ShipmentConfirmResponse> 
    <Response> 
     <TransactionReference> 
      <CustomerContext>00001</CustomerContext> 
      <XpciVersion>1.0001</XpciVersion> 
     </TransactionReference> 
     <ResponseStatusCode>0</ResponseStatusCode> 
     <ResponseStatusDescription>Failure</ResponseStatusDescription> 
     <Error> 
      <ErrorSeverity>Hard</ErrorSeverity> 
      <ErrorCode>120416</ErrorCode> 
      <ErrorDescription>A single billing option is required per shipment. 
      </ErrorDescription> 
     </Error> 
    </Response> 
</ShipmentConfirmResponse> 

不良反應任何人都可以指導我如何來的吧?

+0

也許這個答案是有用的:http://stackoverflow.com/questions/15256029/ups-bill-to-third-party -shipper。這是PHP,但同樣的錯誤和解釋,當這個錯誤應該發生。 – pypat

+0

@pypat我也試過這個,但得到了同樣的結果。 – OpenCurious

+0

您是否知道ShipmentConfirmRequest的端點url列表?我創建了一個XML文件,但不知道將它發佈到哪裏? – highwingers

回答

1

this link,您可能希望聯繫UPS支持,因爲這似乎是一個常見的錯誤 - 但特別是你錯過了<ShipmentCharge>節點。

2

您在裝運請求中缺少以下要素/ShipmentRequest/Shipment/PaymentInformati on/ShipmentCharge/Type。該元素的值可以是01 =運輸02 =關稅和稅收。如果您需要更多關於運輸費用類型的信息,請參閱運輸包裝Web服務開發人員指南(2012年12月31日)的第67頁。

請注意,只有只能有類型等於一個ShipmentCharge元素。

最好!

1

在2013年7月的文檔中,似乎PaymentInformation元素必須是Shipment元素的子元素。

根據我的經驗非常有限的XPath是:/ ShipmentConfirmRequest /發貨/ PaymentInformation

相關問題