Cloud Blog

The Power of Mediators: API Call Transformation and Orchestration

Sometimes you are lucky and the backend web services match exactly your desired public API design. But what if they do not? What if you need to change formats on the fly? Or do XSLT transformation? Or orchestrate multiple backend services called and joined into a single API?

Fear not! WSO2 API Cloud comes with a powerful mediation engine that can transform and orchestrate API calls on the fly.

You can create your mediation sequences and apply them on the fly both on the way to the backend (In Flow) and back to the invoker (Out Flow):

API Cloud mediation sequences

API Cloud’s mediation engine is built on industry-fastest enterprise service bus (ESB) engine and supports amazing variety of mediators that you can use as building blocks for your sequences:

WSO2 Developer Studio can then be used to build your sequences:

Sample mediator sequence

And then you simply upload the sequences to the gateway and select which of them you want used in your APIs.

There are a couple tutorials that we published to illustrate the process:

Using Property Mediator to turn YQL-based Yahoo Weather API into nice REST format:

This is the step-by-step tutorial if you want to follow along:

And here is another one on turning a SOAP backend into a proper JSON REST frontend API.

Here’s the full list of mediators supported and links to detailed documentation:




Core Call Invoke a service in non blocking synchronous manner


Inserts a reference to a sequence


Drops a message


Enriches a message


Sets or remove properties associated with the message


Logs a message



Filters a message using XPath, if-else kind of logic

Validate Validates XML messages against a specified schema.


Filters messages using XPath, switch logic

Conditional Router

Implements complex routing rules (Header based routing, content based routing and other rules)



Performs XSLT transformations on the XML payload

FastXSLT Performs XSLT transformations on the message stream


Modifies and rewrites URLs or URL fragments

XQuery Performs XQuery transformation


Sets or removes SOAP headers

Fault (also called Makefault)

Create SOAP Faults

PayloadFactory Transforms or replaces message content in between the client and the backend server



Evaluates messages based on whether the same message came to the ESB

ForEach Splits a message into a number of different messages by finding matching elements in an XPath expression of the original message.


Clones a message


Splits a message


Combines a message


Blocks web services calls


Executes a set of mediators transactionally


Writes data to database


Retrieves information from database


Evaluates user actions against a XACML policy



Creates and executes a custom mediator


Executes a mediator written in Scripting language

Start your free API Cloud trial now!

Meet WSO2 Cloud Team at WSO2Con US


In less than 2 weeks, we are hosting our main event of the year in the US – the annual WSO2Con in San Francisco, November 2-4. Along with the sister conferences in Europe and Asia, this is the main opportunities for us to meet the community of WSO2 users and partners, share roadmaps, and exchange ideas.

A lot of the WSO2 Cloud team members will be there and there are a lot of great sessions in the agenda.

There is a great session from our cloud technical leads: Amila and Chamith – on how we do DevOps for both public and managed cloud customers:


Myself and Imesh will talk about private cloud deployments, Kubernetes, Docker, and application PaaS technologies from WSO2:


I will cover WSO2 Cloud roadmap:


Imesh demonstrate multi-cloud container deployments:


Lakmal talk about the results of the recent big data in the cloud hackathon:


And finally Amila and Chamith provide details on cloud high availability and automation:


Plus, there will be many sessions on IoT, API Management, Integration, Security, and other hot topics of IT today.

There are still tickets available, so buy yours today, and we will see you in San Francisco the first week of November!

Prototype API in JavaScript in 2 Minutes

Successful companies try things fast, get feedback and iterate – and successful API programs are no exception.

WSO2 API Cloud makes prototyping a new API and running it by your users to collect feedback extremely easy.

All you need to do is:

  1. Define your API: list REST resources and parameters (either in our New API wizard or by importing or editing Swagger definition),
  2. Provide API definition

  3. On the second step of the wizard, pick the Prototype option and Inline to get JavaScript editor displayed with stub implementation in it,
  4. 2-inline-Javascript-prototype

  5. Modify the stub for each HTTP method you need to implement with your custom JavaScript code.
  6. 3-JavaScript-implementation-with-xml-output

  7. Deploy the prototype to your API store: your developers will start seeing the API, be able to invoke it, provide feedback, and so on.

Prototypes can also have versions so you can iterate on your prototypes as your vision evolves, and then substitute the implementation with real backend.

Here’s a video of the whole process – it literally takes less than 2 minutes!

And here’s the detailed tutorial.

Sign up for your free trial of WSO2 API Cloud now, and happy API programs!

99.99% – WSO2 Managed Cloud SLA Goes to Four Nines

99.99 - Guaranteed Uptime for WSO2 Managed CloudWSO2 Managed Cloud – our dedicated hosting offering – just got an upgrade. From now on, all Managed Cloud customers get financially backed 99.99% guaranteed uptime.

This is, of course, in addition to formal SLA on support ticket responses and all other niceties of the service:

  • Available for any combination of WSO2 products,
  • Run in the region of your choice on dedicated virtual machines not shared with any other customers,
  • WSO2 engineers set up the environment including the virtual machines, WSO2 products, and networking,
  • Can be set up to have network connectivity with your on-premise datacenter,
  • Deployment can be customized for your specific needs,
  • Can be combined with professional services including consultancy, development, and QuickStart,
  • Includes full devops service including 24*7 monitoring, regular backups, and product updates,
  • Priced as a fixed monthly fee.

You can find full updated SLA for WSO2 Managed Cloud at:

Fill out the form at the right side of the SLA page to get more information and sign up!


Recent Posts

Most Popular Posts