سؤال

I'm trying to run the PHP test for the UPS Freight Shipping API that came with the official UPS SDK. I finally got it to connect to the SOAP service with a correct username, password, and API key, but now I'm getting an error that I don't know how to solve. The error coming back from the server is

Invalid Ship Request Document

The full response from the server looks like this:

SoapFault Object
(
[message:protected] => An exception has been raised as a result of client data.
[string:private] => 
[code:protected] => 0
[file:protected] => /my_home_dir/UPS_API/test.php
[line:protected] => 224
[trace:private] => Array
    (
        [0] => Array
            (
                [file] => /my_home_dir/UPS_API/test.php
                [line] => 224
                [function] => __soapCall
                [class] => SoapClient
                [type] => ->
                [args] => Array
                    (
                        [0] => ProcessFreightRate
                        [1] => Array
                            (
                                [0] => Array
                                    (
                                        [Request] => Array
                                            (
                                                [RequestOption] => RateChecking Option
                                            )

                                        [ShipFrom] => Array
                                            (
                                                [Name] => Good Incorporation
                                                [Address] => Array
                                                    (
                                                        [AddressLine] => 2010 WARSAW ROAD
                                                        [City] => Roswell
                                                        [StateProvinceCode] => GA
                                                        [PostalCode] => 30076
                                                        [CountryCode] => US
                                                    )

                                            )

                                        [ShipTo] => Array
                                            (
                                                [Name] => Sony Company Incorporation
                                                [Address] => Array
                                                    (
                                                        [AddressLine] => 2311 YORK ROAD
                                                        [City] => TIMONIUM
                                                        [StateProvinceCode] => MD
                                                        [PostalCode] => 21093
                                                        [CountryCode] => US
                                                    )

                                            )

                                        [PaymentInformation] => Array
                                            (
                                                [Payer] => Array
                                                    (
                                                        [Name] => Payer inc
                                                        [Address] => Array
                                                            (
                                                                [AddressLine] => 435 SOUTH STREET
                                                                [City] => RIS TOWNSHIP
                                                                [StateProvinceCode] => NJ
                                                                [PostalCode] => 07960
                                                                [CountryCode] => US
                                                            )

                                                    )

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

                                            )

                                        [Service] => Array
                                            (
                                                [Code] => 308
                                                [Description] => UPS Freight LTL
                                            )

                                        [HandlingUnitOne] => Array
                                            (
                                                [Quantity] => 20
                                                [Type] => Array
                                                    (
                                                        [Code] => PLT
                                                        [Description] => PALLET
                                                    )

                                            )

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

                                                        [Value] => 750
                                                    )

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

                                                        [Length] => 23
                                                        [Width] => 17
                                                        [Height] => 45
                                                    )

                                                [NumberOfPieces] => 45
                                                [PackagingType] => Array
                                                    (
                                                        [Code] => BAG
                                                        [Description] => BAG
                                                    )

                                                [DangerousGoodsIndicator] => 
                                                [CommodityValue] => Array
                                                    (
                                                        [CurrencyCode] => USD
                                                        [MonetaryValue] => 5670
                                                    )

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

                                        [ShipmentServiceOptions] => Array
                                            (
                                                [PickupOptions] => Array
                                                    (
                                                        [HolidayPickupIndicator] => 
                                                        [InsidePickupIndicator] => 
                                                        [ResidentialPickupIndicator] => 
                                                        [WeekendPickupIndicator] => 
                                                        [LiftGateRequiredIndicator] => 
                                                    )

                                                [OverSeasLeg] => Array
                                                    (
                                                        [Dimensions] => Array
                                                            (
                                                                [Volume] => 20
                                                                [UnitOfMeasurement] => Array
                                                                    (
                                                                        [Code] => CF
                                                                        [Description] => String
                                                                    )

                                                            )

                                                        [Value] => Array
                                                            (
                                                                [Cube] => Array
                                                                    (
                                                                        [CurrencyCode] => USD
                                                                        [MonetaryValue] => 5670
                                                                    )

                                                            )

                                                        [COD] => Array
                                                            (
                                                                [CODValue] => Array
                                                                    (
                                                                        [CurrencyCode] => USD
                                                                        [MonetaryValue] => 363
                                                                    )

                                                                [CODPaymentMethod] => Array
                                                                    (
                                                                        [Code] => M
                                                                        [Description] => For Company Check
                                                                    )

                                                                [CODBillingOption] => Array
                                                                    (
                                                                        [Code] => 01
                                                                        [Description] => Prepaid
                                                                    )

                                                                [RemitTo] => Array
                                                                    (
                                                                        [Name] => RemitToSomebody
                                                                        [Address] => Array
                                                                            (
                                                                                [AddressLine] => 640 WINTERS AVE
                                                                                [City] => PARAMUS
                                                                                [StateProvinceCode] => NJ
                                                                                [PostalCode] => 07652
                                                                                [CountryCode] => US
                                                                            )

                                                                        [AttentionName] => C J Parker
                                                                    )

                                                            )

                                                        [DangerousGoods] => Array
                                                            (
                                                                [Name] => Very Safe
                                                                [Phone] => Array
                                                                    (
                                                                        [Number] => 453563321
                                                                        [Extension] => 1111
                                                                    )

                                                                [TransportationMode] => Array
                                                                    (
                                                                        [Code] => CARGO
                                                                        [Description] => Cargo Mode
                                                                    )

                                                            )

                                                        [SortingAndSegregating] => Array
                                                            (
                                                                [Quantity] => 23452
                                                            )

                                                        [CustomsValue] => Array
                                                            (
                                                                [CurrencyCode] => USD
                                                                [MonetaryValue] => 23457923
                                                            )

                                                        [HandlingCharge] => Array
                                                            (
                                                                [Amount] => Array
                                                                    (
                                                                        [CurrencyCode] => USD
                                                                        [MonetaryValue] => 450
                                                                    )

                                                            )

                                                    )

                                            )

                                    )

                            )

                    )

            )

    )

[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
                            )

                    )

            )

    )

)

The code that I am using to make the request can be found here (credentials have been removed for security): http://pastebin.com/Yw7sPQdg

هل كانت مفيدة؟

المحلول

Turns out that I was pointing to the wrong end point. The endpoint url for freight rates should be: https://wwwcie.ups.com/webservices/FreightRate

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top