JSON to XML Transformation
A sample project that demonstrates Payload transformation

Use Case Description

Cookie Mart is a retail biscuit seller that has several stores throughout the country. They recently bought and installed a stock management system in each store. When stocks are running low, this system automatically generates a re-order request and send to Cookie Mart's sole biscuit supplier, Happy Confectionery Limited. This re-order request is generated as JSON and in the following format.
                "id": "12024",
                "name": "Chocolate Cookies",
                "quantity": 1500
                "id": "60294",
                "name": "Spicy Crackers",
                "quantity": 4000
                "id": "36730",
                "name": "Butter Cookies",
                "quantity": 3200
                "id": "53912",
                "name": "Ginger Nuts",
                "quantity": 1800
                "id": "73741",
                "name": "Vanilla Wafers",
                "quantity": 2500
The ordering system of Happy Confectionery Limited accepts orders through its HTTP web service interface, but unfortunately it can only understand the order requests in the XML format shown below. As a result Cookie Mart cannot directly use the JSON request generated by its stock management system to place orders to Happy Confectionery Limited.
<?xml version="1.0" encoding="UTF-8"?>
<hcl:order xmlns:hcl="http://hcl.biscuits">
      <hcl:name>Chocolate Cookies</hcl:name>
      <hcl:name>Spicy Crackers</hcl:name>
      <hcl:name>Butter Cookies</hcl:name>
      <hcl:name>Ginger Nuts</hcl:name>
      <hcl:name>Vanilla Wafers</hcl:name>

Proposed Solution

Since Cookie Mart cannot modify or replace their stock management system, they decided to introduce an ESB to transform the JSON order requests generated by their stock management system to the appropriate XML format.

cookie mart arch

The stock management system of each store will send the JSON formatted order request to HTTP web service exposed by the ESB, and the ESB will transform the request to XML and forward to the web service of Happy Confectionery Limited's ordering system. Then the response received for that request will be proxied back to the stock management system that made the original request.

Version 17.07
Vendor AdroitLogic
Difficulty Introductory

External documentation for this sample project
Source Code
Full source code of this sample project
Contact Us