我是UPS api的新手, 我试图将ShipmentConfirmRequest称为UPS, 这是我使用python发送到wwwcie.ups.com/ups.app/xml/ShipConfirm的xml格式。
<?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>info@agroiilait.com</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 :(得分:2)
您缺少以下元素 / ShipmentRequest / Shipment / PaymentInformati 您的货件申请中的/ on ShipmentCharge / Type 。此元素的值可以是 01 =运输或 02 =职责和税收。如果您需要有关运费类型的更多信息,请参阅运输包Web服务开发人员指南(2012年12月31日)第67页。
请注意,只有类型的 ShipmentCharge 元素只能等于 01 。
最佳!
答案 1 :(得分:1)
从this link开始,您可能希望联系UPS支持部门,因为这似乎是一个常见错误 - 但特别是您错过了<ShipmentCharge>
节点。
答案 2 :(得分:1)
在2013年7月的文档中,看来PaymentInformation元素必须是Shipment元素的子元素。
根据我非常有限的经验,XPath是:/ ShipmentConfirmRequest / Shipment / PaymentInformation