Page History
...
- You can start creating a new data service in two ways:
- Open the dashboard (click Developer Studio -> Open Dashboard) and click Data Service.
- Select the already created Data Service Project in the navigator, right click and go to New -> Data Service.
To start creating a data service from scratch, select Create New Data Service and click Next.
Enter a name for the data service:
Data Service Name RDBMSDataService Click Next and start adding the datasource connection details given below.
Datasource ID Datasource Datasource Type RDBMS Datasource Type (Default/External) Leave Default selected. Database Engine MySQL Driver Class com.mysql.jdbc.Driver URL jdbc:mysql://localhost:3306/Employees User Name root - Save the data service.
A data service file (DBS file) will now be created in your data service project. Shown below is the project directory.
...
- Select the data service you created in the previous step.
- Right-click and click Add Query.
Enter the following query details:
Query ID GetEmployeeDetails Datasource Datasource - Save the query. The query element is now added to the data service:
Right-click the GetEmployeeDetails query and click Add SQL to add the following SQL statement:
Code Block select EmployeeNumber, FirstName, LastName, Email from Employees where EmployeeNumber=:EmployeeNumber
- Save the SQL statement.
Right-click the query again and click Add Input Mapping.
Enter the following input mapping details:
Mapping Name EmployeeNumber Parameter Type SCALAR SQL Type STRING - Save the input mapping.
Right-click the query again and click Add Output Mapping.
Enter the following value to group the output mapping:
Grouped by Element Employees Save the output mapping.
Right-click the output mapping and go to Add Output Mapping → Add Element to create an element.
Enter the following element details.
Datasource Type column Output Field Name EmployeeNumber Datasource Column Name EmployeeNumber Schema Type String - Save the element.
Follow the same steps to create the following output elements:
Datasource Type Output Field Name Datasource Column Name Schema Type column FirstName FirstName string column LastName LastName string column Email Email string - Save the output elements.
...
Right-click the data service and click Add Resource. Add the following resource details.
Resource Method GET Resource Path Employee/{EmployeeNumber} Expand the GET resource, and click the GetEmployeeDetails (call-query). Connect the query to the resource by adding the following:
Query ID GetEmployeeDetails - Save the resource.
The data service should now have the resource added as shown below.
...
- You can start creating a registry resource in two ways:
- Open the dashboard (click Developer Studio -> Open Dashboard) and click Registry Resource.
- Select the already created Registry Resource Project in the navigator, right click and go to New -> Registry Resource.
Select From existing template and click Next.
Enter the following details:Anchor step5 step5 Resource Name Sample_Policy Artifact Name Sample_Policy Template WS-Policy Registry gov Registry path ws-policy/ - Click Finish and the policy file will be listed in the navigator.
Let's use the Design View to enable the required security scenario. For example, enable the Sign and Encyrptand Encrypt security scenario as shown below.
Tip Click the icon next to the scenario to get details of the scenario.
You can also provide encryption properties, signature properties, and advanced rampart configurations as shown below.
Localtab Group Localtab title Encryption/Signature Properties Localtab title Rampart Properties Info title Using role-based permissions? For certain scenarios, you can specify user roles. After you select the scenario, scroll to the right to see the User Roles button.
Either define the user roles inline or retrieve the user roles from the server.
Localtab Group Localtab title Define Inline Localtab title Get from the server
Save the policy file.
...
If you have already created a data service using Tooling, select the file from the Project Explorer. Alternatively, you can download this sample data service file and import it to your Tooling environment.
Once you have select the data service file, click the browse icon for the Policy field.
- 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. - Click OK, and the security policy will be added to the data service.
- Save the data service.
...