This documentation is for WSO2 Application Server version 5.0.0. View documentation for the latest release.

Generate a Data Service Using a Carbon Data Source

The data services feature provides the "Generate" functionality in a product's management console in order to create data services automatically using a given database structure. When generating the service, its table structure is taken according to table structure specified in the data source. "SELECT", "INSERT", "UPDATE", and "DELETE" operations get automatically created.

First, you need to add a data source. For information on adding a data source, refer to section "Data Source Management." Once the Carbon data source is created, follow the instructions below to generate a data service using it.

1. Log on to the product's management console and select "Data Services -> Generate" under the "Main" menu.

2. The "Select Data Source" page appears. Select the Data Source created earlier and provide the database name.

3. Once the database is selected, the table structure will be displayed according to the given database. Select the preferred tables for the data service generation in the "Customize Service Generation" page and click "Next." For example,

4. Once tables are selected, a service generation mode needs to be specified. There are two options to generate the data service.

  • As a single service where all operations for each table are given in a single data service.
  • Multiple services for each table where, for a given table, only operations related to that table will be specified.

In the following example, we create a single service for all tables.

5. Once the service generation mode is selected, the data services will get deployed. View the deployed services and click finish.