UPS API LTL费率给出缺失或无效的国家代码(9360702)

时间:2018-01-29 00:05:02

标签: php api soap ups

我正在向UPS LTL FreightRate发出API调用,以检查从美国到EN(英格兰)的运费价格。

但SOAP调用返回错误9360702说:

Missing or invalid Country Code(s) provided in request.

我实际查看了API PDF,国家/地区代码正确为EN

为什么会出现这种情况?

继承了我的实际要求:

   (
        [Request] = Array
            (
                [RequestOption] = 1
                [SubVersion] = 1601
            )

        [Service] = Array
            (
                [Code] = 308
            )

        [ShipFrom] = Array
            (
                [Name] = 
                [Address] = Array
                    (
                        [AddressLine] = 11552 Kingsmill Place
                        [City] = Odessa
                        [StateProvinceCode] = FL
                        [PostalCode] = 
                        [CountryCode] = US
                    )

            )

        [ShipTo] = Array
            (
                [Name] = 
                [Address] = Array
                    (
                        [AddressLine] = 
                        [City] = 
                        [StateProvinceCode] = 
                        [PostalCode] = E1 4LJ
                        [CountryCode] = EN
                    )

            )

        [PaymentInformation] = Array
            (
                [Payer] = Array
                    (
                        [Name] = MY ADDRESS
                        [Address] = Array
                            (
                                [AddressLine] = 11552 500
                                [City] = Odessa
                                [StateProvinceCode] = FL
                                [PostalCode] = 33556
                                [CountryCode] = US
                            )

                    )

                [ShipmentBillingOption] = Array
                    (
                        [Code] = 10
                    )

            )

        [HandlingUnitOne] = Array
            (
                [Quantity] = 1
                [Type] = Array
                    (
                        [Code] = PLT
                    )

            )

        [Commodity] = Array
            (
                [CommodityID] = 
                [Description] = No Description
                [Weight] = Array
                    (
                        [UnitOfMeasurement] = Array
                            (
                                [Code] = LBS
                            )

                        [Value] = 65
                    )

                [NumberOfPieces] = 2
                [PackagingType] = Array
                    (
                        [Code] = BOX
                    )

                [Dimensions] = Array
                    (
                        [UnitOfMeasurement] = Array
                            (
                                [Code] = IN
                            )

                        [Length] = 11.02
                        [Width] = 14.17
                        [Height] = 5.91
                    )

                [FreightClass] = 70
            )

        [ShipmentServiceOptions] = Array
            (
                [PickupOptions] = Array
                    (
                        [ResidentialPickupIndicator] = 
                        [LiftGateRequiredIndicator] = 
                    )

            )

    )

###更新###

使用SOAP UI使用以下信息和XML重现此错误。

请求网址:https://onlinetools.ups.com/webservices/FreightRate

请务必添加自己的UsernamePasswordLicense NumberShipper Number

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0" xmlns:v11="http://www.ups.com/XMLSchema/XOLTWS/FreightRate/v1.0" xmlns:v12="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
   <soapenv:Header>
      <v1:UPSSecurity>
         <v1:UsernameToken>
            <v1:Username>YOUR USERNAME</v1:Username>
            <v1:Password>YOUR PASSWORK</v1:Password>
         </v1:UsernameToken>
         <v1:ServiceAccessToken>
            <v1:AccessLicenseNumber>YOUR LICENSE NUMBER</v1:AccessLicenseNumber>
         </v1:ServiceAccessToken>
      </v1:UPSSecurity>
   </soapenv:Header>
   <soapenv:Body>
      <v11:FreightRateRequest>
         <v12:Request>
            <!--Zero or more repetitions:-->
            <v12:RequestOption>1</v12:RequestOption>
            <!--Optional:-->
            <v12:SubVersion>1601</v12:SubVersion>
         </v12:Request>
         <v11:ShipFrom>
            <v11:Name></v11:Name>
            <v11:Address>
               <!--1 to 3 repetitions:-->
               <v11:AddressLine>11552 Kingsmill PLace</v11:AddressLine>
               <v11:City>Odessa</v11:City>
               <!--Optional:-->
               <v11:StateProvinceCode>FL</v11:StateProvinceCode>
               <!--Optional:-->
               <v11:Town></v11:Town>
               <!--Optional:-->
               <v11:PostalCode>33556</v11:PostalCode>
               <v11:CountryCode>US</v11:CountryCode>
            </v11:Address>
         </v11:ShipFrom>
         <v11:ShipTo>
            <v11:Name/>
            <v11:Address>
               <!--1 to 3 repetitions:-->
               <v11:AddressLine>266 mile end road</v11:AddressLine>
               <v11:City>London</v11:City>
               <!--Optional:-->
               <v11:StateProvinceCode></v11:StateProvinceCode>
               <!--Optional:-->
               <v11:Town/>
               <!--Optional:-->
               <v11:PostalCode>E1 4LJ</v11:PostalCode>
               <v11:CountryCode>GB</v11:CountryCode>
            </v11:Address>
         </v11:ShipTo>
         <v11:PaymentInformation>
            <v11:Payer>
               <v11:Name></v11:Name>
               <v11:Address>
                  <!--1 to 3 repetitions:-->
                  <v11:AddressLine>11552 Kingsmill Place</v11:AddressLine>
                  <v11:City>Odessa</v11:City>
                  <!--Optional:-->
                  <v11:StateProvinceCode>FL</v11:StateProvinceCode>                 
                  <!--Optional:-->
                  <v11:PostalCode>33556</v11:PostalCode>
                  <v11:CountryCode>US</v11:CountryCode>
               </v11:Address>
               <!--Optional:-->
               <v11:ShipperNumber>YOUR SHIPPER NUMBER</v11:ShipperNumber>
               <!--Optional:-->
               <v11:AttentionName/>
            </v11:Payer>
            <v11:ShipmentBillingOption>
               <v11:Code>10</v11:Code>
               <!--Optional:-->
               <v11:Description/>
            </v11:ShipmentBillingOption>
         </v11:PaymentInformation>
         <v11:Service>
            <v11:Code>308</v11:Code>
            <!--Optional:-->
            <v11:Description/>
         </v11:Service>
         <v11:HandlingUnitOne>
            <v11:Quantity>1</v11:Quantity>
            <v11:Type>
               <v11:Code>PLT</v11:Code>
               <!--Optional:-->
               <v11:Description/>
            </v11:Type>
         </v11:HandlingUnitOne>         
         <!--1 or more repetitions:-->
         <v11:Commodity>
            <!--Optional:-->
            <v11:CommodityID/>
            <v11:Description>No Description</v11:Description>
            <v11:Weight>
               <v11:Value>65</v11:Value>
               <v11:UnitOfMeasurement>
                  <v11:Code>LBS</v11:Code>
                  <!--Optional:-->
                  <v11:Description/>
               </v11:UnitOfMeasurement>
            </v11:Weight>
            <!--Optional:-->
            <v11:Dimensions>
               <v11:UnitOfMeasurement>
                  <v11:Code>IN</v11:Code>
                  <!--Optional:-->
                  <v11:Description/>
               </v11:UnitOfMeasurement>
               <v11:Length>11.02</v11:Length>
               <v11:Width>14.17</v11:Width>
               <v11:Height>5.91</v11:Height>
            </v11:Dimensions>
            <v11:NumberOfPieces>2</v11:NumberOfPieces>
            <v11:PackagingType>
               <v11:Code>BOX</v11:Code>
               <!--Optional:-->
               <v11:Description/>
            </v11:PackagingType>
            <!--Optional:-->
            <v11:FreightClass>70</v11:FreightClass>
         </v11:Commodity>
      </v11:FreightRateRequest>
   </soapenv:Body>
</soapenv:Envelope>

1 个答案:

答案 0 :(得分:2)

我两次联系UPS,最后得到了答复。

事实证明,GB / UK / EN不提供LTL运费等级。这就是国家代码错误的原因。