One of clients Pure Elements Clothing Company Inc wants to integrate the booking of courier service in their ERP system which we developed for DHL and Fedex.
Integrate FedEx is straight forward and we can access their API through the web services mentioned in their portal. They have enough document and program sample to do that.
Integrate DHL is little pain. The entire code is written in Java. Since the LevelFive Solutions has the expertise in all the languages, its easy for us to understand the architecture better and this post will help for so many people who has the background in Ruby.
Before to understand their architecture, here are pre-steps to be done.
Step 1. Get the toolkit from their website. Here are the useful link
XML PI Toolkit – http://xmlpitest-ea.dhl.com/toolkit/Toolkit.zip
Step 2. Register and get an UserId – This is simple. Send a mail to firstname.lastname@example.org and they will generate and send it to you Id.
You need to get the SiteID and Password to integrate DHL. Once the above steps are complete, you are ready to start the integration.
How DHL XML API Works
1. DHL API is running on J2EE Servlet. People who has only the rails background can think of J2EE servlet as Controller in Rails. Whenever you give any URL in Rails, it finally hit the controllers method and execute starts from there.
DHL has two servlets. One for testing and One for production. Here it is.
URL Production – https://xmlpi-ea.dhl.com/XMLShippingServlet
2. DHL servlet accepts only the XML as input and returns XML as Response. If you want to execute any steps, you need to create the XML before access the XML Servlet. Its same like Rails controller method accepts input as arguments.
I have uploaded the samples in https://github.com/lfsolutions/dhl_rails
Have a look and share your comments.