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:product>
<hcl:id>12024</hcl:id>
<hcl:name>Chocolate Cookies</hcl:name>
<hcl:quantity>1500</hcl:quantity>
</hcl:product>
<hcl:product>
<hcl:id>60294</hcl:id>
<hcl:name>Spicy Crackers</hcl:name>
<hcl:quantity>4000</hcl:quantity>
</hcl:product>
<hcl:product>
<hcl:id>36730</hcl:id>
<hcl:name>Butter Cookies</hcl:name>
<hcl:quantity>3200</hcl:quantity>
</hcl:product>
<hcl:product>
<hcl:id>53912</hcl:id>
<hcl:name>Ginger Nuts</hcl:name>
<hcl:quantity>1800</hcl:quantity>
</hcl:product>
<hcl:product>
<hcl:id>73741</hcl:id>
<hcl:name>Vanilla Wafers</hcl:name>
<hcl:quantity>2500</hcl:quantity>
</hcl:product>
</hcl:order>
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.

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.