UPS Shipping API集成错误(PHP)

时间:2012-07-05 05:46:24

标签: php object ups soapfault

我从UPS.com下载ShippingGroundFreightWebService PHP示例。我收到以下错误消息:

 SoapFault Object
(
  [message:protected] => An exception has been raised as a result of client data.
  [string:private] => 
[code:protected] => 0
[file:protected] => /home5/vizparts/public_html/PHP/SoapGroundFreightShipClient.php
[line:protected] => 193
[trace:private] => Array
    (
        [0] => Array
            (
                [file] => /home5/vizparts/public_html/PHP/SoapGroundFreightShipClient.php
                [line] => 193
                [function] => __soapCall
                [class] => SoapClient
                [type] => ->
                [args] => Array
                    (
                        [0] => ProcessShipment
                        [1] => Array
                            (
                                [0] => Array
                                    (
                                        [Request] => Array
                                            (
                                                [RequestOption] => Array
                                                    (
                                                        [0] => 1
                                                        [1] => Shipping
                                                    )

                                            )

                                        [Shipment] => Array
                                            (
                                                [ShipFrom] => Array
                                                    (
                                                        [Name] => Pat Stewart
                                                        [TaxIdentification] => 1234567890
                                                        [Address] => Array
                                                            (
                                                                [AddressLine] => 2311 York Road
                                                                [City] => Timonium
                                                                [StateProvinceCode] => MD
                                                                [PostalCode] => 21093
                                                                [CountryCode] => US
                                                            )

                                                        [AttentionName] => String
                                                        [Phone] => Array
                                                            (
                                                                [Number] => 6785851000
                                                                [Extension] => 123
                                                            )

                                                    )

                                                [ShipperNumber] => 222006
                                                [ShipTo] => Array
                                                    (
                                                        [Name] => Superman
                                                        [Address] => Array
                                                            (
                                                                [AddressLine] => 2010 Warsaw Road
                                                                [StateProvinceCode] => GA
                                                                [PostalCode] => 30076
                                                                [CountryCode] => US
                                                                [City] => Roswell
                                                            )

                                                        [AttentionName] => String
                                                        [Phone] => Array
                                                            (
                                                                [Number] => 6785851000
                                                                [Extention] => 111
                                                            )

                                                    )

                                                [PaymentInformation] => Array
                                                    (
                                                        [Payer] => Array
                                                            (
                                                                [Name] => Superman
                                                                [Address] => Array
                                                                    (
                                                                        [AddressLine] => 2010 Warsaw Road
                                                                        [City] => Roswell
                                                                        [StateProvinceCode] => GA
                                                                        [PostalCode] => 30075
                                                                        [CountryCode] => US
                                                                    )

                                                                [ShipperNumber] => 00613270
                                                                [AttentionName] => String
                                                                [Phone] => Array
                                                                    (
                                                                        [Number] => 6785851000
                                                                    )

                                                            )

                                                        [ShipmentBillingOption] => Array
                                                            (
                                                                [Code] => 10
                                                                [Description] => String
                                                            )

                                                    )

                                                [Service] => Array
                                                    (
                                                        [Code] => 308
                                                        [Description] => String
                                                    )

                                                [HandlingUnitOne] => Array
                                                    (
                                                        [Quantity] => 16
                                                        [Type] => Array
                                                            (
                                                                [Code] => PLT
                                                                [Description] => String
                                                            )

                                                    )

                                                [Commodity] => Array
                                                    (
                                                        [CommodityID] => 22
                                                        [Description] => BUGS
                                                        [Weight] => Array
                                                            (
                                                                [UnitOfMeasurement] => Array
                                                                    (
                                                                        [Code] => LBS
                                                                        [Description] => String
                                                                    )

                                                                [Value] => 511.25
                                                            )

                                                        [Dimensions] => Array
                                                            (
                                                                [UnitOfMeasurement] => Array
                                                                    (
                                                                        [Code] => IN
                                                                        [Description] => String
                                                                    )

                                                                [Length] => 1.25
                                                                [Width] => 1.2
                                                                [Height] => 5
                                                            )

                                                        [NumberOfPieces] => 1
                                                        [PackagingType] => Array
                                                            (
                                                                [Code] => PLT
                                                                [Description] => String
                                                            )

                                                        [CommodityValue] => Array
                                                            (
                                                                [CurrencyCode] => USD
                                                                [MonetaryValue] => 265.2
                                                            )

                                                        [FreightClass] => 60
                                                        [NMFCCommodityCode] => 566
                                                    )

                                                [Reference] => Array
                                                    (
                                                        [Number] => Array
                                                            (
                                                                [Code] => PM
                                                                [Value] => 1651651616
                                                            )

                                                        [BarCodeIndicator] => Array
                                                            (
                                                                [NumberOfCartons] => 5
                                                                [Weight] => Array
                                                                    (
                                                                        [UnitOfMeasurement] => Array
                                                                            (
                                                                                [Code] => LBS
                                                                                [Description] => String
                                                                            )

                                                                        [Value] => 2
                                                                    )

                                                            )

                                                    )

                                            )

                                    )

                            )

                    )

            )

    )

[faultstring] => An exception has been raised as a result of client data.
[faultcode] => Client
[faultcodens] => http://schemas.xmlsoap.org/soap/envelope/
[detail] => stdClass Object
    (
        [Errors] => stdClass Object
            (
                [ErrorDetail] => stdClass Object
                    (
                        [Severity] => Hard
                        [PrimaryErrorCode] => stdClass Object
                            (
                                [Code] => 9121000
                                [Description] => Invalid Ship Request Document
                            )

                    )

            )

    )

)

我想将UPS API集成到我自己的网站中。我想打印运输标签。如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

你应该设置请求xsd文件,在你下载的软件包的其他文件夹中找到它。然后用它设置请求文件。