UPS Shipping API - ShipmentConfirmRequest Error

api, php, ups, xml

Solution

It was the service code container it must be included in the package container. I had it before it. Took me quite a while to figure out this dumb mistake on my part.

Before:

...
<Service>
    <Code>03</Code>
</Service>
<Package>
    ...

After:

...
<Package>
    <Service>
        <Code>03</Code>
    </Service>
    ...

Thanks for the help, and yes UPS requires a strange XML format.

Problem

Hello I am creating a wordpress website for a client using WooCommerce. The site is complete but the client wants the ability to create shipments from the shop_order page. I have most of this figured out, the problem is my XML request to the UPS API. I have checked and recheck, and I cant seem to find the error: ``` <ShipmentConfirmResponse><Response><ResponseStatusCode>0</ResponseStatusCode><ResponseStatusDescription>Failure</ResponseStatusDescription><Error><ErrorSeverity>Hard</ErrorSeverity><ErrorCode>10002</ErrorCode><ErrorDescription>The XML document is well formed but the document is not valid</ErrorDescription></Error></Response></ShipmentConfirmResponse> ``` Below is my xml mark up with sensitive info hidden. ``` <?xml version="1.0" ?> <AccessRequest xml:lang='en-US'> <AccessLicenseNumber>******</AccessLicenseNumber> <UserId>********</UserId> <Password>********</Password> </AccessRequest> <?xml version="1.0" ?> <ShipConfirmRequest xml:lang='en-US'> <Request> <TransactionReference> <CustomerContext>Customer Context</CustomerContext> <XpciVersion>1.0</XpciVersion> </TransactionReference> <RequestAction>ShipConfirm</RequestAction> <RequestOption>validate</RequestOption> </Request> <Shipment> <Shipper> <ShipperNumber>*******</ShipperNumber> <Name>Canyon Werks, LLC</Name> <Address> <AddressLine>2941 Brookspark Drive</AddressLine> <AddressLine></AddressLine> <City>North Las Vegas</City> <StateProvinceCode>NV</StateProvinceCode> <PostalCode>89030</PostalCode> <CountryCode>US</CountryCode> </Address> <Phone> <Number>7022552222</Number> </Phone> </Shipper> <ShipTo> <Name>Justin Walker</Name> <Address> <AddressLine>2675 Windmill Pkwy</AddressLine> <AddressLine>3024</AddressLine> <City>Henderson</City> <StateProvinceCode>NV</StateProvinceCode> <PostalCode>89074</PostalCode> <CountryCode>US</CountryCode> </Address> <Phone> <Number>7024609485</Number> </Phone> </ShipTo> <ShipFrom> <Name>Canyon Werks, LLC</Name> <Address> <AddressLine>2941 Brookspark Drive</AddressLine> <AddressLine></AddressLine> <City>North Las Vegas</City> <StateProvinceCode>NV</StateProvinceCode> <PostalCode>89030</PostalCode> <CountryCode>US</CountryCode> </Address> <Phone> <Number>7022552222</Number> </Phone> </ShipFrom> <PaymentInformation> <ShipmentCharge> <Type>01</Type> <BillShipper> <AccountNumber>*******</AccountNumber> </BillShipper> </ShipmentCharge> </PaymentInformation> <Service> <Code>03</Code> </Service> <Package> <Packaging> <Code>02</Code> <Description>Customer Supplied</Description> </Packaging> <Dimensions> <UnitOfMeasurement> <Code>IN</Code> </UnitOfMeasurement> <Length>16</Length> <Width>12</Width> <Height>6</Height> </Dimensions> <PackageWeight> <UnitOfMeasurement> <Code>LBS</Code> </UnitOfMeasurement> <Weight>6.07</Weight> </PackageWeight> </Package> </Shipment> <LabelSpecification> <LabelImageFormat> <Code>GIF</Code> </LabelImageFormat> </LabelSpecification> </ShipConfirmRequest> ``` I am almost there on this, but I am stuck at this road block. If anyone can shed some light into this it would be much appreciated.

Original source

Related problems