FedEx Dry Ice via FedEx API

fedex

Solution

Below is a sample FedEx Label Request with Dry Ice which works. Credentials and address information have been removed.

Dry ice info goes in `RequestedShipment/RequestedPackageLineItems/SpecialServicesRequested`

While the Documentation also says to put it in `RequestedShipment/SpecialServicesRequested` I found that doing so would always lead to the following error

8616 (Dry Ice cannot be entered at the shipment level.)

Also note that this package also has `SIGNATURE_OPTION` enabled. The ordering of these and any other `SpecialServiceTypes` is extremely important. If you are using other Package level Special Services and are getting a `Schema validation failed for request` error, you may need to re-order the fields or contact FedEx support for help in the ordering. `DRY_ICE` must always be the first Special Service Type and the `DryIceWeight` element must come after the list of special services, but before any of the extra elements those Services require.

Sample Dry Ice shipment request:

<ns:ProcessShipmentRequest xmlns:ns="http://fedex.com/ws/ship/v15" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://fedex.com/ws/ship/v15 ShipService v15.xsd">
    <ns:WebAuthenticationDetail>
        <ns:UserCredential>
            <ns:Key></ns:Key>
            <ns:Password></ns:Password>
        </ns:UserCredential>
    </ns:WebAuthenticationDetail>
    <ns:ClientDetail>
        <ns:AccountNumber></ns:AccountNumber>
        <ns:MeterNumber></ns:MeterNumber>
    </ns:ClientDetail>
    <ns:TransactionDetail>
        <ns:CustomerTransactionId>CreatePendingRequest</ns:CustomerTransactionId>
    </ns:TransactionDetail>
    <ns:Version>
        <ns:ServiceId>ship</ns:ServiceId>
        <ns:Major>15</ns:Major>
        <ns:Intermediate>0</ns:Intermediate>
        <ns:Minor>0</ns:Minor>
    </ns:Version>
    <ns:RequestedShipment>
        <ns:ShipTimestamp>2016-10-25T11:03:40-07:00</ns:ShipTimestamp>
        <ns:DropoffType>REGULAR_PICKUP</ns:DropoffType>
        <ns:ServiceType>PRIORITY_OVERNIGHT</ns:ServiceType>
        <ns:PackagingType>YOUR_PACKAGING</ns:PackagingType>
        <ns:Shipper>
            <ns:Contact>
                <ns:CompanyName>Name</ns:CompanyName>
                <ns:PhoneNumber>Phone</ns:PhoneNumber>
            </ns:Contact>
            <ns:Address>
                <ns:StreetLines>Street</ns:StreetLines>
                <ns:StreetLines>Street</ns:StreetLines>
                <ns:City>City</ns:City>
                <ns:StateOrProvinceCode>CA</ns:StateOrProvinceCode>
                <ns:PostalCode>ZIP</ns:PostalCode>
                <ns:CountryCode>US</ns:CountryCode>
            </ns:Address>
        </ns:Shipper>
        <ns:Recipient>
            <ns:Contact>
                <ns:PersonName>Name</ns:PersonName>
                <ns:PhoneNumber>Phone</ns:PhoneNumber>
            </ns:Contact>
            <ns:Address>
                <ns:StreetLines>123 MAIN STREET</ns:StreetLines>
                <ns:StreetLines>MAIL SLOT 45</ns:StreetLines>
                <ns:City>City</ns:City>
                <ns:StateOrProvinceCode>CA</ns:StateOrProvinceCode>
                <ns:PostalCode>Xip</ns:PostalCode>
                <ns:CountryCode>US</ns:CountryCode>
            </ns:Address>
        </ns:Recipient>
        <ns:ShippingChargesPayment>
            <ns:PaymentType>SENDER</ns:PaymentType>
            <ns:Payor>
                <ns:ResponsibleParty>
                    <ns:AccountNumber></ns:AccountNumber>
                    <ns:Contact>
                        <ns:CompanyName>Name</ns:CompanyName>
                    </ns:Contact>
                    <ns:Address>
                        <ns:CountryCode>US</ns:CountryCode>
                    </ns:Address>
                </ns:ResponsibleParty>
            </ns:Payor>
        </ns:ShippingChargesPayment>
        <ns:SpecialServicesRequested>
        </ns:SpecialServicesRequested>
        <ns:LabelSpecification>
            <ns:LabelFormatType>COMMON2D</ns:LabelFormatType>
            <ns:ImageType>ZPLII</ns:ImageType>
            <ns:LabelStockType>STOCK_4X6</ns:LabelStockType>
            <ns:LabelPrintingOrientation>TOP_EDGE_OF_TEXT_FIRST</ns:LabelPrintingOrientation>
            <ns:PrintedLabelOrigin>
                <ns:Contact>
                    <ns:CompanyName>Company</ns:CompanyName>
                    <ns:PhoneNumber>Phone</ns:PhoneNumber>
                </ns:Contact>
                <ns:Address>
                    <ns:StreetLines>Street</ns:StreetLines>
                    <ns:City>City</ns:City>
                    <ns:StateOrProvinceCode>CA</ns:StateOrProvinceCode>
                    <ns:PostalCode>Zip</ns:PostalCode>
                    <ns:CountryCode>US</ns:CountryCode>
                </ns:Address>
            </ns:PrintedLabelOrigin>
        </ns:LabelSpecification>
        <ns:RateRequestTypes>LIST</ns:RateRequestTypes>
        <ns:PackageCount>1</ns:PackageCount>
        <ns:RequestedPackageLineItems>
            <ns:SequenceNumber>1</ns:SequenceNumber>
            <ns:Weight>
                <ns:Units>LB</ns:Units>
                <ns:Value>8</ns:Value>
            </ns:Weight>
            <ns:Dimensions>
                <ns:Length>5</ns:Length>
                <ns:Width>5</ns:Width>
                <ns:Height>4</ns:Height>
                <ns:Units>IN</ns:Units>
            </ns:Dimensions>
            <ns:CustomerReferences>
                <ns:CustomerReferenceType>CUSTOMER_REFERENCE</ns:CustomerReferenceType>
                <ns:Value>CD0000002199</ns:Value>
            </ns:CustomerReferences>
            <ns:CustomerReferences>
                <ns:CustomerReferenceType>P_O_NUMBER</ns:CustomerReferenceType>
                <ns:Value>0000497600</ns:Value>
            </ns:CustomerReferences>
            <ns:SpecialServicesRequested>
                <ns:SpecialServiceTypes>DRY_ICE</ns:SpecialServiceTypes>
                <ns:SpecialServiceTypes>SIGNATURE_OPTION</ns:SpecialServiceTypes>
                <ns:DryIceWeight>
                    <ns:Units>KG</ns:Units>
                    <ns:Value>2.5</ns:Value>
                </ns:DryIceWeight>
                <ns:SignatureOptionDetail>
                    <ns:OptionType>DIRECT</ns:OptionType>
                </ns:SignatureOptionDetail>
            </ns:SpecialServicesRequested>
        </ns:RequestedPackageLineItems>
    </ns:RequestedShipment>
</ns:ProcessShipmentRequest>

Problem

Is anyone familiar enough with the FedEx API to get Dry Ice to work? The FedEx documentation for Dry Ice is here: https://www.fedex.com/us/developer/WebHelp/ws/2014/dvg/WS_DVG_WebHelp/index.htm#25_2_Dry_Ice_Coding_Details.htm This doesn't seem to really match their WSDL however. No matter what I've tried I'm always getting back a schema validation error. Is anyone able to provide a sample request including dry ice with a successful response? I cannot find any information on where the correct place to put the RequestedPackages element is. I put it on the same level as RequestedShipment as well as several other places and got nowhere. If I put only the RequestedShipment fields in place and not the package info I get: ``` 8616 (Dry Ice cannot be entered at the shipment level.) ``` Sample Request This Sample request feels the closest I've gotten. FedEx does not like the position of the `RequestedPackages` element though. I've taken out a lot of the unnecessary fields like address information below: ``` <ns:ProcessShipmentRequest xmlns:ns="http://fedex.com/ws/ship/v15" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://fedex.com/ws/ship/v15 ShipService v15.xsd"> <ns:WebAuthenticationDetail> <ns:UserCredential> </ns:UserCredential> </ns:WebAuthenticationDetail> <ns:ClientDetail> </ns:ClientDetail> <ns:TransactionDetail> <ns:CustomerTransactionId>CreatePendingRequest</ns:CustomerTransactionId> </ns:TransactionDetail> <ns:Version> <ns:ServiceId>ship</ns:ServiceId> <ns:Major>15</ns:Major> <ns:Intermediate>0</ns:Intermediate> <ns:Minor>0</ns:Minor> </ns:Version> <ns:RequestedShipment> <ns:ShipTimestamp>2016-10-21T10:17:09-07:00</ns:ShipTimestamp> <ns:DropoffType>REGULAR_PICKUP</ns:DropoffType> <ns:ServiceType>PRIORITY_OVERNIGHT</ns:ServiceType> <ns:PackagingType>YOUR_PACKAGING</ns:PackagingType> <ns:SpecialServicesRequested> <ns:SpecialServiceTypes>DRY_ICE</ns:SpecialServiceTypes> <ns:ShipmentDryIceDetail> <ns:PackageCount>1</ns:PackageCount> <ns:TotalWeight> <ns:Units>KG</ns:Units> <ns:Value>2.5</ns:Value> </ns:TotalWeight> </ns:ShipmentDryIceDetail> </ns:SpecialServicesRequested> <ns:LabelSpecification> <ns:LabelFormatType>COMMON2D</ns:LabelFormatType> <ns:ImageType>ZPLII</ns:ImageType> <ns:LabelStockType>STOCK_4X6</ns:LabelStockType> <ns:LabelPrintingOrientation>TOP_EDGE_OF_TEXT_FIRST</ns:LabelPrintingOrientation> </ns:LabelSpecification> <ns:RateRequestTypes>LIST</ns:RateRequestTypes> <ns:PackageCount>1</ns:PackageCount> <ns:RequestedPackageLineItems> <ns:SequenceNumber>1</ns:SequenceNumber> <ns:Weight> <ns:Units>LB</ns:Units> <ns:Value>8</ns:Value> </ns:Weight> <ns:Dimensions> </ns:Dimensions> <ns:SpecialServicesRequested> <ns:SpecialServiceTypes>SIGNATURE_OPTION</ns:SpecialServiceTypes> <ns:SignatureOptionDetail> <ns:OptionType>SERVICE_DEFAULT</ns:OptionType> </ns:SignatureOptionDetail> </ns:SpecialServicesRequested> </ns:RequestedPackageLineItems> </ns:RequestedShipment> <ns:RequestedPackages> <ns:SpecialServicesRequested> <ns:SpecialServiceTypes>DRY_ICE</ns:SpecialServiceTypes> <ns:DryIceWeight> <ns:Units>KG</ns:Units> <ns:Value>2.5</ns:Value> </ns:DryIceWeight> </ns:SpecialServicesRequested> </ns:RequestedPackages> </ns:ProcessShipmentRequest> ``` FedEx Response: ``` Element not allowed: RequestedPackages@http://fedex.com/ws/ship/v15 in element ProcessShipmentRequest@http://fedex.com/ws/ship/v15 ``` I've also tried putting the package level dry ice info in the `RequestedPackageLineItems/SpecialServicesRequested` section, but got the following response: ``` Expected elements \'PieceCountVerificationBoxCount@http://fedex.com/ws/ship/v15 PriorityAlertDetail@http://fedex.com/ws/ship/v15 AlcoholDetail@http://fedex.com/ws/ship/v15\' instead of \'DryIceWeight@http://fedex.com/ws/ship/v15\' here in element SpecialServicesRequested@http://fedex.com/ws/ship/v15 ```

Original source