Skip to content

Exposing Non-HTTP Services as RESTful APIs

This example demonstrates how the WSO2 Micro Integrator forwards messages to non-HTTP endpoints.

Synapse configuration

Following is a sample REST API configuration that we can used to implement this scenario. See the instructions on how to build and run this example.

<api xmlns="" name="EventDelayOrderAPI" context="/orderdelayAPI"> 
        <resource methods="POST" url-mapping="/"> 
              <property name="REST_URL_POSTFIX" action="remove" scope="axis2"></property> 
                    <address uri=

When using a non-HTTP endpoint, such as a JMS endpoint, in the API definition, you must remove the REST_URL_POSTFIX property to avoid any characters specified after the context (such as a trailing slash) in the request from being appended to the JMS endpoint.

Notice that we have specified the REST_URL_POSTFIX property with the value set to "remove". When invoking this API, even if the request contains a trailing slash after the context (e.g., POST instead of POST, the endpoint will be called correctly.

Build and run

Create the artifacts:

  1. Set up WSO2 Integration Studio.
  2. Create an ESB Solution project
  3. Create the rest api with the configurations given above.
  4. Deploy the artifacts in your Micro Integrator.

Configure the ActiveMQ broker with your Micro Intergrator.

Set up the back-end service:

  1. Download the stockquote_service.jar
  2. Open a terminal, navigate to the location of the downloaded service, and run it using the following command:

    java -jar stockquote_service.jar

Invoke the REST API with a POST message.