[Download] | [Documentation Home] | [Release Note]

Automated Data Service Creation Through DB Connection

Introduction


WSO2 Data Services Server provides the feature to create data services automatically using a given database structure. When generating the service, DS Generator will consider the table structure. According to the given table structure "SELECT", "INSERT", "UPDATE", and "DELETE" operations will get automatically created.

Step 1 - Create a Carbon Data Source


Before generating the data services Carbon data source should be created according to the database properties.


DS

Figure 1: Create Carbon Data Source


Step 2 - Select Data Source


To start the ds generation click on 'Generate' link on your left hand menu.


DS

Figure 2: Generate Data Service


In the first screen that appears select the Carbon Data Source and the Database Name as shown below.


DS

Figure 2: Select Data Source


Step 3 - Select Database Schema


After Data Source is selected, DB Schema needs to be selected to identify the needed tables.

DS

Figure 3: Select DB Schema


Step 4 - Select Tables


Once the schema is selected, the table structure will display according to the given schema. Select the preferred tables for the data service generation.

DS

Figure 4: Select Table Set


Step 5 - Select the Service Generation Mode


Once tables are defined, service generation mode needs to be specified. There are two options to generate the data service. 1. as a single service - where all operations for each table are given in a single data service. 2. Multiple services for each table - where for a given table only operations related to that table will be specified. Following example creates a single service for all tables as shown below.


DS

Figure 6: Select DS Generation Mode


Once service generation mode is selcted, data services will get deployed, click next to view deployed services and click finish.


DS

Figure 7: Created Services


Step 8: Service deployed


Now we have created a data service. You can go the deployed services list which is under Manage/Service/List. Created service will be list as follows. If multiple service mode is selected, multiple services will get generated according to the number of tables selected.


DS

Figure 8: Deployed data services


Step 9 - Try your service - Single Service Mode


Click on "Try It" link to invoke the service. As seen in Figure 6, operations (Select, Update, Insert and Delete) for both tables are embedded in the same data service.


DS

Figure 6: Try-it - Single Service Mode

Step 9 - Try your service - Multiple Service Mode


If Multiple service Mode is selected, different data services will get generated per each table.


DS

Figure 6: Try-it - Multiple Service Mode