This documentation is for WSO2 Enterprise Integrator version 6.1.1 . 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

The following sections describe how WSO2 EI Tooling can be used to create artifacts for data integration. 

Creating a data service project

  1. You can either use the link on the dashboard (click Developer Studio -> Open Dashboard) as shown below, or use the File-> New -> Other -> Data Service Project option.


     
  2. On the window that appears, specify a project name. 


     
  3. If you want to customize the Maven options (such as including parent POM information in the file from another project in this workspace), click Next and specify the options.
  4. Click Finish.

Creating a data service

A data service provides a Web service interface to access data that is stored in relational databases, CSV files, Microsoft Excel sheets, Google spreadsheets, and more. You can create a new data service or import an existing data service from a data service descriptor (DBS) file.  

Creating a new data service

Follow these steps to create a new data service. Alternatively, you can import an existing data service.

  1. You can either use the Data Service Project link on the dashboard (click Developer Studio -> Open Dashboard) or right-click on the Data Service project and click New -> Data Service
  2. Select Create New Data Service and click Next.
  3. Type unique names for the project and data service.
  4. Optionally, specify the service group, namespace, description, location, and working set for this data service.
  5. Click Next and specify a unique ID for the data source.
  6. Specify the type of data source you are creating, and then configure the properties that appear for that type. For details on configuring various data source types, see the data integration tutorials.
  7. A Maven POM file will be generated automatically for this project. If you want to customize the Maven options (such as including parent POM information in the file from another project in this workspace), click Next and specify the options.
  8. Click Finish. The data service is created, and the data service is open in the editor. You can now right-click the data service in the outline and add queries, operations, additional data sources, and so on, or click the Source view to add components using XML.  

Importing a data service

Follow these steps to import an existing data service from a data service descriptor (DBS) file. Alternatively, you can create a new data service.

  1. You can either use the Data Service link on the dashboard (click Developer Studio -> Open Dashboard) or right-click on the Data Service project and click New -> Data Service
  2. Select Import Data Service and click Next.
  3. Specify the data service descriptor (DBS) file by typing its full pathname or clicking Browse and navigating to the file.
  4. Optionally specify the location and working sets for this project. 
  5. A Maven POM file will be generated automatically for this project. If you want to customize the Maven options (such as including parent POM information in the file from another project in this workspace), click Next and specify the options.
  6. Click Finish. The data service is created, and the data service is open in the editor. You can now right-click the data service in the outline and add queries, operations, additional data sources, and so on, or click the Source view to add components using XML.

Applying security to a data service

WSO2 supports WS-Security, WS-Policy, and WS-Security Policy specifications and these specifications define a behavioral model for Web services. To enable a security policy for a data service, you need to first create a security policy file, and then add it to the data service.

Step 1: Create a security policy

Follow the instructions given below.

  1. Open your data service in Developer Studio as explained in the Creating a new data service section given above. You can either create a new data service or import an existing DBS file.

  2. Now, open the Developer Studio Dashboard (click Developer Studio > Open Dashboard) and click Registry Resource Project.
  3. Enter a name for the project and click Next.
    enter details of the new project
  4. Enter the Maven information about the project and click Finish.
    enter maven information about the project
  5. Right-click on the SecurityPolicyProject in the left navigation panel, click New and then select Registry Resource.
    right click and create registry resource
  6. Enter a resource name and select the WS-Policy template along with the preferred registry path. 

  7. Click Finish and the policy file will be listed in the navigator.
  8. Double-click on the policy file to view the list of security policies. You can use the Design View or the Source View.

  9. Enable required scenario. Click the icon next to each scenario for more information.
  10. You can provide service information as a private store, and advanced configuration information as a rampart configuration.
  11. For certain scenarios, you can specify user roles. After you select the scenario, scroll to the right to see the User Roles button.
  12. Either define the user roles inline or retrieve the user roles from the server.

  13. The security policy will now be saved to the resource project as shown below.

Step 2: Add the security policy to the data service

  1. Once you have configured the policy file, you can add the security policy to the data service as explained below. 

    1. Select the sample data service (.dbs file) that is already stored in the workspace, and click the browse icon for the Policy field.

      There are two ways to add a security policy to the data service: If you have a policy file already stored in your product registry, you can add it by clicking registry. If you want to use a new policy file that you have created and stored in your current workspace, you can add it by clicking workspace.

    2. Click workspace, to add the security policy from the current workspace. You can select the path to the sample_policy.xml file that you created in the previous steps.
    3. Click OK, and the security policy will be added to the data service.

You now have a security policy added to your data service. When you creating a creating a CAR file to deploy this data service in your ESB server, be sure to set the server role to Enterprise Service Bus as explained below.

Filtering content by user role (Optional)

When you work with data services, you can control access to sensitive data for specific user roles. This facility is called role-based content filtering. It filters data where specific data sections are only accessible to a given type of users. Follow the instructions given below to add role-based filtering for output elements in your data service. 

  1. Open the data service file in WSO2 EI tooling.
  2. Add an output element to your data service:
    1. Right-click the data service and click Add Query to add a new query.
    2. Right-click the query and click Add Output Mapping to add an output mapping.
    3. Right-click the output mapping and go to Add Output Mapping → Add Element to add an element.
  3. Add the user roles as a comma-separated list in the Allowed User Roles field for the output element as shown below.

Adding multiple data services

It is possible to add multiple data services to a Data Service project by following the steps described above. The project structure will be as follows:

 

Creating a custom validator

An input validator allows a data service to validate the input parameters in a request and stop the execution of the request if the input doesn’t meet the required criteria. In addition to the default validators provided by Data Service Server, you can create your own custom validators by creating a Java class that implements the org.wso2.carbon.dataservices.core.validation.Validator interface. You can create a new custom validator or import an existing validator project.  

Creating a new custom validator

Follow these steps to create a new custom validator. Alternatively, you can import an existing validator project.

  1. You can either use the Data Services Validator Project link on the dashboard (click Developer Studio -> Open Dashboard) or click File-> New -> Other -> Data Services Validator Project option. 
  2. Select Create New Data Services Validator Project and click Next.
  3. Type a unique name for the project and specify the package and class name for this validator.
  4. Optionally, specify the location and working set for this project.
  5. A Maven POM file will be generated automatically for this project. If you want to customize the Maven options (such as including parent POM information in the file from another project in this workspace), click Next and specify the options.
  6. Click Finish. The project is created, and the new validator class is open in the editor, where you can add your validation logic.  

Importing a validator project

Follow these steps to import an existing custom validator project. Alternatively, you can create a new custom validator.

  1. You can either use the Data Services Validator Project link on the dashboard (click Developer Studio -> Open Dashboard) or click File-> New -> Other -> Data Services Validator Project option. 
  2. Select Import Project From Workspace and click Next.
  3. Select the existing validator project, and optionally specify the location and working sets for the new project. 
  4. A Maven POM file will be generated automatically for this project. If you want to customize the Maven options (such as including parent POM information in the file from another project in this workspace), click Next and specify the options.
  5. Click Finish. The project is imported, and the validator class is open in the editor, where you can modify the validation logic as needed.

Deploying the data service in WSO2 EI

Once you have created the data service artifacts as explained in the previous topics, you need to create a Composite Application project, and then create a CAR file to deploy it in the ESB server.

  1. Right-click the Project Explorer and click New -> Project.
  2. From the window that opens, click Composite Application Project.
  3. Give a name to the Composite Application project and select the projects that you need to group into your C-App from the list of available projects.
  4. In the Composite Application Project POM Editor that opens, under Dependencies, note the information for each of the projects you selected earlier. If you have added a security policy to your data service using a registry resource as explained above, be sure that EnterpriseServiceBus is selected as the server role as shown below.


  5. To deploy the artifacts using the ESB's management console, you need to create a CAR file as follows:
    • Right-click the C-App project and select Export Composite Application Project from the pop-up menu. 
      OR
    • Open the pom.xml file in the Composite Application Project POM Editor and click the button for creating an archive in the upper-right corner.

    The CAR file is now saved in the location you specify. See Packaging Artifacts into Composite Applications, for more information on using CAR files

  6. Next, deploy the CAR file in the server.
  • No labels