A Multi-Protocol Gateway (MPGW) in IBM DataPower can receive client requests over various protocols and forward them to a backend using a completely different protocol. This flexibility allows seamless integration between systems that speak different languages. In this post, we’ll configure a loopback MPGW that receives a JSON message and converts it to XML using an XSLT stylesheet — no backend server involved.
Create an XSLT file named jsontoXML.xsl
with the following content. We’ll use it in the processing policy to transform the incoming JSON payload into XML.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dp="http://www.datapower.com/extensions" extension-element-prefixes="dp" exclude-result-prefixes="dp json"
xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<EmployeeData>
<Name>
<xsl:value-of select="//json:object[@name='EmployeeData']/json:string[@name='name']"/>
</Name>
<Email>
<xsl:value-of select="//json:object[@name='EmployeeData']/json:string[@name='email']"/>
</Email>
<Address>
<City>
<xsl:value-of select="//json:object[@name='EmployeeData']/json:object[@name='address']/json:string[@name='city']"/>
</City>
<Country>
<xsl:value-of select="//json:object[@name='EmployeeData']/json:object[@name='address']/json:string[@name='country']"/>
</Country>
<AddressLine1>
<xsl:value-of select="//json:object[@name='EmployeeData']/json:object[@name='address']/json:string[@name='addressLine1']"/>
</AddressLine1>
</Address>
<PhoneNumbers>
<Phone1>
<xsl:value-of select="//json:object[@name='EmployeeData']/json:object[@name='phoneNumbers']/json:string[@name='phone1']"/>
</Phone1>
<Phone2>
<xsl:value-of select="//json:object[@name='EmployeeData']/json:object[@name='phoneNumbers']/json:string[@name='phone2']"/>
</Phone2>
</PhoneNumbers>
</EmployeeData>
</xsl:template>
</xsl:stylesheet>
I’ll walk through the following four configuration steps, starting with the Processing Policy. First, search for ‘New Multi-Protocol Gateway’ and click on it. Enter a name for your MPGW, then proceed with the steps below.

1. Create the Processing Policy
Click on + button, a policy window will open. Enter policy name as Json-to-xml-PP
click apply policy and then click on New Rule. This policy will contain the logic for message transformation.

double click on match action and and select URL-All from dropdown.

Drag transform action on assembly line

double click on it and provide following details, input as __JSONASJSONX, upload the XSLT file (jsontoXML.xsl) that you created earlier.

drag advance action on assembly line

double click on it and search for set variable, select it and click next.

enter the highlighted details and click done

drag result action and click apply policy and close window.

2. Set Type as Dynamic Backend
- Under Type, choose Dynamic-backend.
- This is essential for a loopback service, as there’s no actual backend — responses are managed internally. We skipped the backend in processing policy with skip-backside service variable.
3. Configure Front Side Protocol
- Under Front Side Settings, set up the Front Side Protocol (FSP).
- Create an HTTP handler (e.g.,
json-to-xml-fsh-2037
) - This is the interface clients will use to send JSON messages.
Click on + button and select HTTP Handler

provide the below details and click Apply button.

4. Set Request and Response Types
- Request Type: Select JSON
- Response Type: Select XML
Final Multi Protocol Gateway looks like below screen shot.

Final Step: Testing the MPGW
Use any HTTP client (e.g., Postman or cURL) to test your Multi-Protocol Gateway with the following JSON payload:
Request:
{
"EmployeeData": {
"name": "John",
"email": "Johnalia@gmail.com",
"address": {
"city": "New York",
"country": "US",
"addressLine1": "theme park"
},
"phoneNumbers": {
"phone1": "212 555-1111",
"phone2": "212 555-2222"
}
}
}
Expected Response:
<?xml version="1.0" encoding="UTF-8"?>
<EmployeeData>
<Name>John</Name>
<Email>Johnalia@gmail.com</Email>
<Address>
<City>New York</City>
<Country>US</Country>
<AddressLine1>theme park</AddressLine1>
</Address>
<PhoneNumbers>
<Phone1>212 555-1111</Phone1>
<Phone2>212 555-2222</Phone2>
</PhoneNumbers>
</EmployeeData>

Conclusion!
We’ve set up a loopback MPGW in IBM DataPower to convert JSON to XML using XSLT — no backend needed. This is a simple yet powerful pattern for format transformation in integration flows. Stay tuned for more quick how-tos!
1 Pingback