Sunday, May 8, 2016

Publish a service which provides both XML/JSON via SOAP/REST protocols in WSO2 ESB

Let's say we want to define a service in WSO2 ESB that provides the same information using different formats and protocols. It should provide both XML and JSON formats (for example 2 operations) and should be provided as SOAP and REST.
This service will consume a DSS service we will deploy as SOAP and as REST.

What is the best way to achieve this via WSO2 ESB?

1. The best approach is to use a proxy for support XML and invoke SOAP endpoint and an API for support JSON and invoke REST endpoint.

2.Then the problem is, publishing it as a proxy we get all the facilities provided in the dashboard. If we use an API we do not have the dashboard options available (statistics, mediation tracer...)

As a solution:
a. we can move the content of the API to a separate sequence then we can get the dashboard options.
b. publish them via a BAM

3. Further, we can define a sequence which transform XML to JSON and vice versa in both Proxy and API and share it with both API and Proxy.

No comments: