Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this tutorial, we will run through the process of exposing and RDBMS as an OData service. When OData is enabled for a datasource, you do not need to manually define CRUD operations. They are automatically created.

...

Follow the steps given below.

  1. Open a terminal, navigate to the <EI_HOME>/bin directory, and start Start the WSO2 ESB profile.

    Panel
    borderColor#542989
    bgColor#ffffff
    borderWidth1
    Localtabgroup
    Localtab
    activetrue
    titleOn MacOS/Linux/
    Mac./integrator.shWindowsintegrator.bat --run
    CentOS

    Open a terminal and execute the following command:

    Code Block
    wso2ei-6.3.0-integrator
    Localtab
    titleOn Windows
    Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.3.0 Integrator. This will open a terminal and start the ESB profile.
  2. Open the ESB profile's Management Console using https://localhost:9443/carbon, and log in using admin as the username and the password.
  3. When you connect the datasource, select the OData check box as shown below.

Access the data service using CRUD operations

Open a command prompt execute the following CURL commands using CRUD operations:

Note

Note that you should have privileges to perform CRUD operations on the database. If not, the OData service will not work properly.

  • To get the service document:

    Code Block
    curl -X GET -H 'Accept: application/json' https://localhost:8243/odata/{data_service_name}/{data_source_id}
  • To get the metadata of the service:

    Code Block
    curl -X GET -H 'Accept: application/xml' https://localhost:8243/odata/{data_service_name}/{data_source_id}/$metadata
  • To read details from the ACCOUNT table:

    Code Block
    curl -X GET -H 'Accept: application/xml' https://localhost:8243/odata/{data_service_name}/{data_source_id}/ACCOUNT