我在加拿大和美国国家/地区使用 UPS API,发货地始终是加拿大。以下是我传递的请求,以获取 UPS 费率并获取预计到达时间。如果我为加拿大地址传递以下请求参数,它可以正常响应,但如果我在 UPS API 请求参数中传递美国地址,则会引发Invalid Shipment Contents Value
错误。
以下是适用于加拿大地址的 UPS API请求及其响应,但不适用于任何美国地址:
要求
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>******</AccessLicenseNumber>
<UserId>*****</UserId>
<Password>*****</Password>
</AccessRequest><?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Rating and Service</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>Rate</RequestAction>
<RequestOption>Shoptimeintransit</RequestOption>
</Request>
<PickupType>
<Code>01</Code>
<Description>Regular Daily Pickup</Description>
</PickupType>
<Shipment> <Shipper><ShipperNumber>****</ShipperNumber> <Address>
<City>Scarborough</City>
<PostalCode>M1G 0A6</PostalCode>
<CountryCode>CA</CountryCode>
<StateProvinceCode>ON</StateProvinceCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<PostalCode>14304</PostalCode>
<CountryCode>US</CountryCode>
<ResidentialAddress>02</ResidentialAddress>
<StateProvinceCode>NY</StateProvinceCode> </Address>
</ShipTo>
<ShipFrom>
<Address>
<PostalCode>M1G 0A6</PostalCode>
<CountryCode>CA</CountryCode>
<StateProvinceCode>ON</StateProvinceCode>
</Address>
</ShipFrom>
<DeliveryTimeInformation>
<PackageBillType>03</PackageBillType>
</DeliveryTimeInformation>
<Package>
<PackagingType>
<Code>00</Code>
</PackagingType>
<PackageWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>0.2</Weight>
</PackageWeight>
</Package>
<ShipmentTotalWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>0.2</Weight>
</ShipmentTotalWeight><RateInformation><NegotiatedRatesIndicator/></RateInformation> </Shipment>
</RatingServiceSelectionRequest>
回复
<RatingServiceSelectionResponse>
<Response>
<TransactionReference>
<CustomerContext>Rating and Service</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<ResponseStatusCode>0</ResponseStatusCode>
<ResponseStatusDescription>Failure</ResponseStatusDescription>
<Error>
<ErrorSeverity>Hard</ErrorSeverity>
<ErrorCode>111549</ErrorCode>
<ErrorDescription>Invalid Shipment Contents Value.</ErrorDescription>
</Error>
</Response>
</RatingServiceSelectionResponse>
我在上面的美国地址请求中做错了什么?