WSO2 Developer’s Guide
上QQ阅读APP看书,第一时间看更新

Data Service Project

Data Service Project will be used to add data services that allow us to access multiple data sources and expose their data in a very simple way. To create this kind of project, we will start from the Developer Studio dashboard, as usual, and follow these steps:

  1. Click on Data Service Project and add the name and location of the project.
  2. Click on Next and enter the Maven information for the project, that is, Group Id, Artifact Id, and Version. If needed, we can specify the parent project as well, and then click on Finish:
  1. Now, we have added the new data service project to the workspace:

Now, we can create the data services needed for our application.

To add a new data service, go to the Developer Studio dashboard and click on Data Service.

Then, follow these steps:

  1. Choose Create a New Data Service and click on Next.
  2. In this step, we will introduce some general information related to the service:
    • Data Service Name*: This is the desired name.
    • Data Service Group: This is a name for a group, if we would like to group some data services. This is not mandatory and hence we leave it blank.
    • Data Service Namespace: This specifies the namespace for our service.
    • Description: We can add a description here.
    • Save Data Service in: The Data Service Project where we can locate the data service.
  1. Click on Next. Now, we will add the data source information for our data service. There are many ways to create data sources, but according to our experience, the best practice is to create the data sources in the WSO2EI and create references from data services. This way, we can have just one point of data source configuration that provides many advantages. Thus, we will add the following information:
    • Data Source Id: This is a name for the datasource.
    • Data Source Type: As we discussed earlier, we choose Carbon Data Source here, which means that we reference a data source already created in the system.
    • Data Source Name: This is the name of the data source we are referencing.
  1. Click on Finish and the data service will be added:

We can start building our data service by double-clicking on the file. We are now done with the data service edition, and we will go deeper into it in the later chapters.