T-Shirt Service REST API

Mule Configuration Image
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:validation="http://www.mulesoft.org/schema/mule/validation" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:wsc="http://www.mulesoft.org/schema/mule/wsc" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:apikit="http://www.mulesoft.org/schema/mule/mule-apikit" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/mule-apikit http://www.mulesoft.org/schema/mule/mule-apikit/current/mule-apikit.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd 
http://www.mulesoft.org/schema/mule/wsc http://www.mulesoft.org/schema/mule/wsc/current/mule-wsc.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/xml-module http://www.mulesoft.org/schema/mule/xml-module/current/mule-xml-module.xsd
http://www.mulesoft.org/schema/mule/validation http://www.mulesoft.org/schema/mule/validation/current/mule-validation.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
    <http:listener-config name="-wsdl-RAML10-httpListenerConfig"> 
        <http:listener-connection host="0.0.0.0" port="8081"/> 
    </http:listener-config>  
    <apikit:config name="-wsdl-RAML10-config" api="resource::b7e4bd92-2b77-4ace-8d77-6dc23983a079:TshirtServiceRestWrapper:1.1.6:raml:zip:-wsdl-RAML10.raml" outboundHeadersMapName="outboundHeaders" httpStatusVarName="httpStatus"/>  
    <wsc:config name="Web_Service_Consumer_Config" doc:name="Web Service Consumer Config" doc:id="f1d4d675-a8db-4a47-96c0-afab8ea5e974"> 
        <wsc:connection wsdlLocation="http://tshirts.demos.mulesoft.com/?wsdl" service="TshirtServicePortTypeService" port="TshirtServicePortTypePort" address="https://tshirts.demos.mulesoft.com/"> 
            <wsc:web-service-security actor="http://schemas.xmlsoap.org/soap/actor/next"/> 
        </wsc:connection> 
    </wsc:config>  
    <flow name="-wsdl-RAML10-main"> 
        <http:listener config-ref="-wsdl-RAML10-httpListenerConfig" path="/api/*"> 
            <http:response statusCode="#[vars.httpStatus default 200]"> 
                <http:headers>#[vars.outboundHeaders default {}]    </http:headers> 
            </http:response>  
            <http:error-response statusCode="#[vars.httpStatus default 500]"> 
                <http:body>#[payload]   </http:body>  
                <http:headers>#[vars.outboundHeaders default {}]    </http:headers> 
            </http:error-response> 
        </http:listener>  
        <apikit:router config-ref="-wsdl-RAML10-config"/>  
        <error-handler> 
            <on-error-propagate type="APIKIT:BAD_REQUEST"> 
                <ee:transform> 
                    <ee:message> 
                        <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Bad request"}]]> </ee:set-payload>
                    </ee:message>  
                    <ee:variables> 
                        <ee:set-variable variableName="httpStatus">400  </ee:set-variable> 
                    </ee:variables> 
                </ee:transform> 
            </on-error-propagate>  
            <on-error-propagate type="APIKIT:NOT_FOUND"> 
                <ee:transform> 
                    <ee:message> 
                        <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Resource not found"}]]>  </ee:set-payload>
                    </ee:message>  
                    <ee:variables> 
                        <ee:set-variable variableName="httpStatus">404  </ee:set-variable> 
                    </ee:variables> 
                </ee:transform> 
            </on-error-propagate>  
            <on-error-propagate type="APIKIT:METHOD_NOT_ALLOWED"> 
                <ee:transform> 
                    <ee:message> 
                        <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Method not allowed"}]]>  </ee:set-payload>
                    </ee:message>  
                    <ee:variables> 
                        <ee:set-variable variableName="httpStatus">405  </ee:set-variable> 
                    </ee:variables> 
                </ee:transform> 
            </on-error-propagate>  
            <on-error-propagate type="APIKIT:NOT_ACCEPTABLE"> 
                <ee:transform> 
                    <ee:message> 
                        <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Not acceptable"}]]>  </ee:set-payload>
                    </ee:message>  
                    <ee:variables> 
                        <ee:set-variable variableName="httpStatus">406  </ee:set-variable> 
                    </ee:variables> 
                </ee:transform> 
            </on-error-propagate>  
            <on-error-propagate type="APIKIT:UNSUPPORTED_MEDIA_TYPE"> 
                <ee:transform> 
                    <ee:message> 
                        <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Unsupported media type"}]]>  </ee:set-payload>
                    </ee:message>  
                    <ee:variables> 
                        <ee:set-variable variableName="httpStatus">415  </ee:set-variable> 
                    </ee:variables> 
                </ee:transform> 
            </on-error-propagate>  
            <on-error-propagate type="APIKIT:NOT_IMPLEMENTED"> 
                <ee:transform> 
                    <ee:message> 
                        <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Not Implemented"}]]> </ee:set-payload>
                    </ee:message>  
                    <ee:variables> 
                        <ee:set-variable variableName="httpStatus">501  </ee:set-variable> 
                    </ee:variables> 
                </ee:transform> 
            </on-error-propagate> 
        </error-handler> 
    </flow>  
    <flow name="-wsdl-RAML10-console"> 
        <http:listener config-ref="-wsdl-RAML10-httpListenerConfig" path="/console/*"> 
            <http:response statusCode="#[vars.httpStatus default 200]"> 
                <http:headers>#[vars.outboundHeaders default {}]    </http:headers> 
            </http:response>  
            <http:error-response statusCode="#[vars.httpStatus default 500]"> 
                <http:body>#[payload]   </http:body>  
                <http:headers>#[vars.outboundHeaders default {}]    </http:headers> 
            </http:error-response> 
        </http:listener>  
        <apikit:console config-ref="-wsdl-RAML10-config"/>  
        <error-handler> 
            <on-error-propagate type="APIKIT:NOT_FOUND"> 
                <ee:transform> 
                    <ee:message> 
                        <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Resource not found"}]]>  </ee:set-payload>
                    </ee:message>  
                    <ee:variables> 
                        <ee:set-variable variableName="httpStatus">404  </ee:set-variable> 
                    </ee:variables> 
                </ee:transform> 
            </on-error-propagate> 
        </error-handler> 
    </flow>  
    <flow name="get:\ListInventory" doc:id="b4b54d5d-792c-4c43-ba28-24f6e81d6592" tracking:enable-default-events="true"> 
        <http:listener doc:name="Listener" doc:id="a5d887bc-9160-4c9a-a0c3-c88f6e178fab" config-ref="-wsdl-RAML10-httpListenerConfig" path="/ListInventory" allowedMethods="GET"/>  
        <wsc:consume doc:name="Consume" doc:id="225e094d-5798-4d37-857c-aaae7290f155" config-ref="Web_Service_Consumer_Config" operation="ListInventory"> 
            <wsc:message> 
                <wsc:body><![CDATA[#[output application/xml
ns ns0 http://mulesoft.org/tshirt-service
---
{
    ns0#ListInventory: null
}]]]>   </wsc:body>
            </wsc:message> 
        </wsc:consume>  
        <ee:transform doc:id="3e983fb7-e7c6-400f-b0c5-d10bf49f3462"> 
            <ee:message> 
                <ee:set-payload><![CDATA[%dw 2.0
output application/json
ns ns0 http://mulesoft.org/tshirt-service
---
payload.body.ns0#ListInventoryResponse.*inventory map ( inventory , indexOfInventory ) -> {
    productCode: inventory.productCode,
    size: inventory.size ,
    count: inventory.count ,
    description: inventory.description
}]]>    </ee:set-payload>
            </ee:message> 
        </ee:transform> 
    </flow>  
    <flow name="post:\OrderTshirt" tracking:enable-default-events="true"> 
        <http:listener doc:name="Listener" doc:id="753f6f6a-b311-482f-9235-200ea9daa8b0" config-ref="-wsdl-RAML10-httpListenerConfig" path="/OrderTshirt" allowedMethods="POST"> 
            <http:error-response> 
                <http:body><![CDATA[#[%dw 2.0
output application/json
---
{
  "errorMessage": "Order failed to be created."
}]]]>   </http:body>
            </http:error-response> 
        </http:listener>  
        <ee:transform doc:id="27a106c8-abe8-42e9-aa6b-2128f8f17529"> 
            <ee:message> 
                <ee:set-payload><![CDATA[%dw 2.0
output application/xml
ns ns0 http://mulesoft.org/tshirt-service
---
{
    ns0#OrderTshirt: {
        size: payload.size,
        email: payload.email,
        name: payload.name,
        address1: payload.address1,
        address2: payload.address2,
        city: payload.city,
        stateOrProvince: payload.stateOrProvince,
        postalCode: payload.postalCode,
        country: payload.country
    }
}]]>    </ee:set-payload>
            </ee:message> 
        </ee:transform>  
        <wsc:consume doc:name="Consume" doc:id="6f6388f8-1d6e-4b12-9693-b6ea4fd5f844" config-ref="Web_Service_Consumer_Config" operation="OrderTshirt"> 
            <wsc:message> 
                <wsc:body><![CDATA[#[output application/xml
---
payload]]]> </wsc:body>
            </wsc:message> 
        </wsc:consume>  
        <ee:transform doc:name="Transform Message" doc:id="633f2588-6c16-4060-99df-a7f51f4c3682"> 
            <ee:message> 
                <ee:set-payload><![CDATA[%dw 2.0
output application/json
ns ns0 http://mulesoft.org/tshirt-service
---
{
    orderId: payload.body.ns0#OrderTshirtResponse.orderId
}]]>    </ee:set-payload>
            </ee:message> 
        </ee:transform>  
        <json:validate-schema doc:name="Validate schema" doc:id="d3881e19-ac86-431d-a19e-68ce962838ba" dereferencing="INLINE" schema="json-schema-order-shirt.json"/>  
        <error-handler> 
            <on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" doc:id="f42d1707-66b3-4ba2-8f9d-cf69892f0e0e"> 
                <ee:transform doc:name="Transform Message" doc:id="751fb3ee-1768-44cc-9ff0-bb1a046ee468"> 
                    <ee:message> 
                        <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{
  "errorMessage": "Order failed to be created."
}]]>    </ee:set-payload>
                    </ee:message> 
                </ee:transform> 
            </on-error-propagate> 
        </error-handler> 
    </flow>  
    <flow name="post:\TrackOrder" tracking:enable-default-events="true"> 
        <http:listener doc:name="Listener" doc:id="1cd2ec02-23fb-4e2f-acce-8c5cdb7681c0" config-ref="-wsdl-RAML10-httpListenerConfig" path="/TrackOrder" allowedMethods="POST"> 
            <http:error-response> 
                <http:body><![CDATA[#[%dw 2.0
output application/json
---
{
  "errorMessage": "Order does not exist."
}]]]>   </http:body>
            </http:error-response> 
        </http:listener>  
        <ee:transform doc:name="Transform Message" doc:id="0d5be338-5bd0-4e5b-9548-4fab7ecab648"> 
            <ee:message> 
                <ee:set-payload><![CDATA[%dw 2.0
output application/xml
ns ns0 http://mulesoft.org/tshirt-service
---
{
    ns0#TrackOrder: {
        email: payload.email,
        orderId: payload.orderId
    }
}]]>    </ee:set-payload>
            </ee:message> 
        </ee:transform>  
        <wsc:consume doc:name="Consume" doc:id="e1734a7f-3dbd-4ec5-9d1e-51ee32fe5c44" config-ref="Web_Service_Consumer_Config" operation="TrackOrder"> 
            <wsc:message> 
                <wsc:body><![CDATA[#[output application/xml
---
payload]]]> </wsc:body>
            </wsc:message> 
        </wsc:consume>  
        <ee:transform doc:id="26996ad8-4482-4221-8c75-02c4a1c0eff9"> 
            <ee:message> 
                <ee:set-payload><![CDATA[%dw 2.0
output application/json
ns ns0 http://mulesoft.org/tshirt-service
---
{
    size: (payload.body.ns0#TrackOrderResponse.size),
    orderId: (payload.body.ns0#TrackOrderResponse.orderId),
    status: (payload.body.ns0#TrackOrderResponse.status)
}]]>    </ee:set-payload>
            </ee:message> 
        </ee:transform>  
        <json:validate-schema doc:name="Validate schema" doc:id="effdb4ed-7cb9-4ab4-9c44-191b6bec6776" dereferencing="INLINE" schema="json-schema-track-order.json"/>  
        <error-handler> 
            <on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" doc:id="36f3b5ac-a54a-4598-a2d8-cac21e37991c"> 
                <ee:transform doc:name="Transform Message" doc:id="5eecf5e1-8562-4a0d-9a96-de4f0c230e93"> 
                    <ee:message> 
                        <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{
  "errorMessage": "Order does not exist."
}]]>    </ee:set-payload>
                    </ee:message> 
                </ee:transform> 
            </on-error-propagate> 
        </error-handler> 
    </flow> 
</mule>
_wsdl_RAML10_main image
<?xml version="1.0" encoding="UTF-8"?>

<flow name="-wsdl-RAML10-main">  
    <http:listener config-ref="-wsdl-RAML10-httpListenerConfig" path="/api/*">  
        <http:response statusCode="#[vars.httpStatus default 200]"> 
            <http:headers>#[vars.outboundHeaders default {}]    </http:headers> 
        </http:response>  
        <http:error-response statusCode="#[vars.httpStatus default 500]"> 
            <http:body>#[payload]   </http:body>  
            <http:headers>#[vars.outboundHeaders default {}]    </http:headers> 
        </http:error-response> 
    </http:listener>  
    <apikit:router config-ref="-wsdl-RAML10-config">    </apikit:router>  
    <error-handler> 
        <on-error-propagate type="APIKIT:BAD_REQUEST"> 
            <ee:transform >  
                <ee:message> 
                    <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Bad request"}]]> </ee:set-payload>
                </ee:message>  
                <ee:variables> 
                    <ee:set-variable variableName="httpStatus">400  </ee:set-variable> 
                </ee:variables> 
            </ee:transform> 
        </on-error-propagate>  
        <on-error-propagate type="APIKIT:NOT_FOUND"> 
            <ee:transform >  
                <ee:message> 
                    <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Resource not found"}]]>  </ee:set-payload>
                </ee:message>  
                <ee:variables> 
                    <ee:set-variable variableName="httpStatus">404  </ee:set-variable> 
                </ee:variables> 
            </ee:transform> 
        </on-error-propagate>  
        <on-error-propagate type="APIKIT:METHOD_NOT_ALLOWED"> 
            <ee:transform >  
                <ee:message> 
                    <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Method not allowed"}]]>  </ee:set-payload>
                </ee:message>  
                <ee:variables> 
                    <ee:set-variable variableName="httpStatus">405  </ee:set-variable> 
                </ee:variables> 
            </ee:transform> 
        </on-error-propagate>  
        <on-error-propagate type="APIKIT:NOT_ACCEPTABLE"> 
            <ee:transform >  
                <ee:message> 
                    <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Not acceptable"}]]>  </ee:set-payload>
                </ee:message>  
                <ee:variables> 
                    <ee:set-variable variableName="httpStatus">406  </ee:set-variable> 
                </ee:variables> 
            </ee:transform> 
        </on-error-propagate>  
        <on-error-propagate type="APIKIT:UNSUPPORTED_MEDIA_TYPE"> 
            <ee:transform >  
                <ee:message> 
                    <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Unsupported media type"}]]>  </ee:set-payload>
                </ee:message>  
                <ee:variables> 
                    <ee:set-variable variableName="httpStatus">415  </ee:set-variable> 
                </ee:variables> 
            </ee:transform> 
        </on-error-propagate>  
        <on-error-propagate type="APIKIT:NOT_IMPLEMENTED"> 
            <ee:transform >  
                <ee:message> 
                    <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Not Implemented"}]]> </ee:set-payload>
                </ee:message>  
                <ee:variables> 
                    <ee:set-variable variableName="httpStatus">501  </ee:set-variable> 
                </ee:variables> 
            </ee:transform> 
        </on-error-propagate> 
    </error-handler> 
</flow>

_wsdl_RAML10_console image
<?xml version="1.0" encoding="UTF-8"?>

<flow name="-wsdl-RAML10-console">  
    <http:listener config-ref="-wsdl-RAML10-httpListenerConfig" path="/console/*">  
        <http:response statusCode="#[vars.httpStatus default 200]"> 
            <http:headers>#[vars.outboundHeaders default {}]    </http:headers> 
        </http:response>  
        <http:error-response statusCode="#[vars.httpStatus default 500]"> 
            <http:body>#[payload]   </http:body>  
            <http:headers>#[vars.outboundHeaders default {}]    </http:headers> 
        </http:error-response> 
    </http:listener>  
    <apikit:console config-ref="-wsdl-RAML10-config">   </apikit:console>  
    <error-handler> 
        <on-error-propagate type="APIKIT:NOT_FOUND"> 
            <ee:transform >  
                <ee:message> 
                    <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{message: "Resource not found"}]]>  </ee:set-payload>
                </ee:message>  
                <ee:variables> 
                    <ee:set-variable variableName="httpStatus">404  </ee:set-variable> 
                </ee:variables> 
            </ee:transform> 
        </on-error-propagate> 
    </error-handler> 
</flow>

get_ListInventory image
<?xml version="1.0" encoding="UTF-8"?>

<flow name="get:\ListInventory" doc:id="b4b54d5d-792c-4c43-ba28-24f6e81d6592" tracking:enable-default-events="true">  
    <http:listener doc:name="Listener" doc:id="a5d887bc-9160-4c9a-a0c3-c88f6e178fab" config-ref="-wsdl-RAML10-httpListenerConfig" path="/ListInventory" allowedMethods="GET">   </http:listener>  
    <wsc:consume doc:name="Consume" doc:id="225e094d-5798-4d37-857c-aaae7290f155" config-ref="Web_Service_Consumer_Config" operation="ListInventory">  
        <wsc:message> 
            <wsc:body><![CDATA[#[output application/xml
ns ns0 http://mulesoft.org/tshirt-service
---
{
    ns0#ListInventory: null
}]]]>   </wsc:body>
        </wsc:message> 
    </wsc:consume>  
    <ee:transform doc:id="3e983fb7-e7c6-400f-b0c5-d10bf49f3462">  
        <ee:message> 
            <ee:set-payload><![CDATA[%dw 2.0
output application/json
ns ns0 http://mulesoft.org/tshirt-service
---
payload.body.ns0#ListInventoryResponse.*inventory map ( inventory , indexOfInventory ) -> {
    productCode: inventory.productCode,
    size: inventory.size ,
    count: inventory.count ,
    description: inventory.description
}]]>    </ee:set-payload>
        </ee:message> 
    </ee:transform> 
</flow>

post_OrderTshirt image
<?xml version="1.0" encoding="UTF-8"?>

<flow name="post:\OrderTshirt" tracking:enable-default-events="true">  
    <http:listener doc:name="Listener" doc:id="753f6f6a-b311-482f-9235-200ea9daa8b0" config-ref="-wsdl-RAML10-httpListenerConfig" path="/OrderTshirt" allowedMethods="POST">  
        <http:error-response> 
            <http:body><![CDATA[#[%dw 2.0
output application/json
---
{
  "errorMessage": "Order failed to be created."
}]]]>   </http:body>
        </http:error-response> 
    </http:listener>  
    <ee:transform doc:id="27a106c8-abe8-42e9-aa6b-2128f8f17529">  
        <ee:message> 
            <ee:set-payload><![CDATA[%dw 2.0
output application/xml
ns ns0 http://mulesoft.org/tshirt-service
---
{
    ns0#OrderTshirt: {
        size: payload.size,
        email: payload.email,
        name: payload.name,
        address1: payload.address1,
        address2: payload.address2,
        city: payload.city,
        stateOrProvince: payload.stateOrProvince,
        postalCode: payload.postalCode,
        country: payload.country
    }
}]]>    </ee:set-payload>
        </ee:message> 
    </ee:transform>  
    <wsc:consume doc:name="Consume" doc:id="6f6388f8-1d6e-4b12-9693-b6ea4fd5f844" config-ref="Web_Service_Consumer_Config" operation="OrderTshirt">  
        <wsc:message> 
            <wsc:body><![CDATA[#[output application/xml
---
payload]]]> </wsc:body>
        </wsc:message> 
    </wsc:consume>  
    <ee:transform doc:name="Transform Message" doc:id="633f2588-6c16-4060-99df-a7f51f4c3682">  
        <ee:message> 
            <ee:set-payload><![CDATA[%dw 2.0
output application/json
ns ns0 http://mulesoft.org/tshirt-service
---
{
    orderId: payload.body.ns0#OrderTshirtResponse.orderId
}]]>    </ee:set-payload>
        </ee:message> 
    </ee:transform>  
    <json:validate-schema doc:name="Validate schema" doc:id="d3881e19-ac86-431d-a19e-68ce962838ba" dereferencing="INLINE" schema="json-schema-order-shirt.json">    </json:validate-schema>  
    <error-handler> 
        <on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" doc:id="f42d1707-66b3-4ba2-8f9d-cf69892f0e0e">  
            <ee:transform doc:name="Transform Message" doc:id="751fb3ee-1768-44cc-9ff0-bb1a046ee468">  
                <ee:message> 
                    <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{
  "errorMessage": "Order failed to be created."
}]]>    </ee:set-payload>
                </ee:message> 
            </ee:transform> 
        </on-error-propagate> 
    </error-handler> 
</flow>

post_TrackOrder image
<?xml version="1.0" encoding="UTF-8"?>

<flow name="post:\TrackOrder" tracking:enable-default-events="true">  
    <http:listener doc:name="Listener" doc:id="1cd2ec02-23fb-4e2f-acce-8c5cdb7681c0" config-ref="-wsdl-RAML10-httpListenerConfig" path="/TrackOrder" allowedMethods="POST">  
        <http:error-response> 
            <http:body><![CDATA[#[%dw 2.0
output application/json
---
{
  "errorMessage": "Order does not exist."
}]]]>   </http:body>
        </http:error-response> 
    </http:listener>  
    <ee:transform doc:name="Transform Message" doc:id="0d5be338-5bd0-4e5b-9548-4fab7ecab648">  
        <ee:message> 
            <ee:set-payload><![CDATA[%dw 2.0
output application/xml
ns ns0 http://mulesoft.org/tshirt-service
---
{
    ns0#TrackOrder: {
        email: payload.email,
        orderId: payload.orderId
    }
}]]>    </ee:set-payload>
        </ee:message> 
    </ee:transform>  
    <wsc:consume doc:name="Consume" doc:id="e1734a7f-3dbd-4ec5-9d1e-51ee32fe5c44" config-ref="Web_Service_Consumer_Config" operation="TrackOrder">  
        <wsc:message> 
            <wsc:body><![CDATA[#[output application/xml
---
payload]]]> </wsc:body>
        </wsc:message> 
    </wsc:consume>  
    <ee:transform doc:id="26996ad8-4482-4221-8c75-02c4a1c0eff9">  
        <ee:message> 
            <ee:set-payload><![CDATA[%dw 2.0
output application/json
ns ns0 http://mulesoft.org/tshirt-service
---
{
    size: (payload.body.ns0#TrackOrderResponse.size),
    orderId: (payload.body.ns0#TrackOrderResponse.orderId),
    status: (payload.body.ns0#TrackOrderResponse.status)
}]]>    </ee:set-payload>
        </ee:message> 
    </ee:transform>  
    <json:validate-schema doc:name="Validate schema" doc:id="effdb4ed-7cb9-4ab4-9c44-191b6bec6776" dereferencing="INLINE" schema="json-schema-track-order.json">    </json:validate-schema>  
    <error-handler> 
        <on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" doc:id="36f3b5ac-a54a-4598-a2d8-cac21e37991c">  
            <ee:transform doc:name="Transform Message" doc:id="5eecf5e1-8562-4a0d-9a96-de4f0c230e93">  
                <ee:message> 
                    <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{
  "errorMessage": "Order does not exist."
}]]>    </ee:set-payload>
                </ee:message> 
            </ee:transform> 
        </on-error-propagate> 
    </error-handler> 
</flow>