This documentation is for WSO2 Enterprise Integrator version 6.0.0 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
Skip to end of metadata
Go to start of metadata

WSO2 Enterprise Integrator (WSO2 EI) allows you to expose data stored in various datasources as REST-style resources in addition to SOAP services. The tutorials on creating data services from scratch will guide you on how to expose data as SOAP services.

The following instructions explain how you can expose data as a REST resource:

Defining a REST resource

Let's take a data service that is already created using an RDBMS and expose the data as REST-style resources.

  1. Follow the tutorial on exposing an RDBMS as a data service to create the RDBMS data service.
  2. Log in to the product's Management Console.
  3. Click List under Main → Services. The RDBMS data service you created in the previous step will be listed.
  4. Click the data service to open the Service Dashboard of that data service.
  5. Click Edit Data Service (Wizard) to open the data service using the Create Data Service wizard.
  6. Click Next, until you get to the Resources screen. 
  7. Click Add New Resource to open the Resources screen shown below. You can now expose the data as REST resource.

    The fields in the above screen are explained below.
    • Resource Path: The resource name that is appended to the end of the resource URI. There are two ways of giving the resource path:
      • Use a query path with the following format: <resource_path_name>/{Input_Parameter}
      • Use a query parameter by giving a name for the resource path. For example, enter Product, if you are querying for products.
    • Resource Method: The HTTP operation (GET, POST, PUT or DELETE).
    • Query ID: The corresponding query for the resource invocation.

  8. We will proceed to create a resource using the GET method. Enter values as follows:
    1. Enter Account/{AccountID} in the Resource Path field.
    2. Select GET as the Resource Method.
    3. Select the query in the Query ID field.
    Adding the resource
  9. Save the resource.
  10. Save the data service.

Invoking the REST resource

The service can be invoked in REST-style via curl ( Shown below is the curl command to invoke the GET resource:

curl -X GET http://localhost:8280/services/RDBMS.HTTPEndpoint/Account/1

Sending message payloads

If you are sending request payloads to a REST resource defined in the data service, the object name specified in the payload must be in the following format: "_<HTTP_METHOD><RESOURCE_PATH>", where RESOURCE_PATH represents the path value specified in the data service resource. However, if the RESOURCE_PATH specified in the data service contains the "/" symbol, be sure to replace the "/" symbol with the underscore symbol ("_") in the payload object name. See the following examples.

If the RESOURCE_PATH is "wso2employee", the payload object name should be as follows:

  • For HTTP POST requests: _postwso2employee
  • For HTTP PUT requests: _putwso2employee

If the RESOURCE_PATH is "wso2/employee", the payload object name should be as follows:

  • For HTTP POST requests: _postwso2_employee
  • For HTTP PUT requests: _putwso2_employee

If you are sending a batch request, and if the resource path is "wso2/employee",  the payload object should be as follows:

  • For HTTP POST requests: 

        "_postwso2_employee_batch_req": {
            "_postwso2_employee": [
  • For HTTP PUT requests:

        "_putwso2_employee_batch_req": {
            "_putwso2_employee": [
  • No labels