FedEx Package Rate Integration with NetSuite direct integrate by WebServices-CarlZeng

Quick TECHNICAL Note

Reality: UPS only support WebServices integration(or window platform exe application: FedEx Ship Manager® Lite), friendly for JAVA, PHP or C#.

We need to calling UPS SOAP services in NetSuite directly, so there is JSON -> XML for input expected XML parameters and parse API return result XML -> JSON action. 

Different from UPS, There is high request for xml’s element order/sequence for FedEx API.

This’s a re-usable framework for intergration with WebServices platform/application.

Registration for the Developer Keys

We will need registration on webside got

Developer Test Key: PFPtfQE9ME1N****
Required for FedEx Web Services for Intra Country Shipping in US and Global

and the Email Box:

Title: Your Developer Test Key Registration is complete

Test Account Information
<spacer.gif>
Test URL: https://wsbeta.fedex.com:443/web-services
Test Password: H6F4kyFrYIQxALXOTbH53****

FedEx Web Services Testing Information:
FedEx Shipping Account Number: **0088000
FedEx Meter Number: ***2012**

On NetSuite Side we are targeting to achieve xml files like the sample:

Example 1:Rate Request

<SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/“ xmlns:SOAP-
ENC=”http://schemas.xmlsoap.org/soap/encoding/“ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“ xmlns:xsd=”http://www.w3.org/2001/XMLSchema“ xmlns=”http://fedex.com/ws/rate/v28">
SOAP-ENV:Body



XXXXXX
XXXXXX


XXXXXX
XXXXXX



XXXXXX
XXXXXX


RateRequest_v28


crs
28
0
0


2020-02-25T12:34:56-06:00
REGULAR_PICKUP
PRIORITY_OVERNIGHT
FEDEX_BOX

LB 20.0 XXXXXX FedEx-WAPI XXXXXX
SN2000 Test Meter 8 10 Fedex Parkway AUSTIN TX XXXXXX US
XXXXXX Recipient Contact XXXXXX
Recipient Address Line 1 Recipient Address Line 2 Collierville TN XXXXXX US
SENDER XXXXXX BUSINESS\_STATE 123456 LIST 1 1 1 1 LB 20.0 12 12 12 IN XXXXXX XXXXXX 12 ContentDescription

And all above xml element is dynamically transfered from NetSuite Sales Order data(and also data from location, currency, custom record types, settings), We got those data(in expected order), using the Google Project’s X2JS to convert from JSON to XML.

Next resolve the across domain ajax call by using NetSuite 2.0 API https.post

var response = https.post({
url: ‘https://wsbeta.fedex.com:443/web-services‘,
body: new X2JS().json2xml_str(PostDataObj),
headers: {
“Accept”: “image/gif, image/jpeg, image/pjpeg, text/plain, text/html, */*“,
“Content-Type”: “text/xml”,
“Access-Control-Allow-Origin”: ‘*‘,
}
});

Need to thanks this thread for useful notes: https://stackoverflow.com/questions/62523251/creating-a-http-post-call-for-fedex-web-services  

FedEx Webservices Errors

  • Response Code 400 or 500

    • Accross domain Error
    • Schema Error

     

  • UnrecoverableClientError
    SchemaError
    validation failure for RateRequest Error:cvc-complex-type.2.4.a: Invalid content was found starting with element

    • Check the XML object sent to FedEx, the order of the element MUST match to the WDSL schema
    • Check the XML object elements if there is addtional property
  • FedEx 404 Unrecoverable ClientError

Share tools used between XML and JSON

Estimate Rate

Integrate with existing UPS integration

While end-use switching shipping carries, we need to clean up the backend package list data and rebuild for current shipping carrier, since UPS and FedEx are using DIFFERENT formating and propertys.

个性化需求沟通 扫客服加V加群: