Applying QoS for a Service
Quality of Service (QoS) provides security and reliability to a service. QoS can be applied to Web Services by associating it with the Web Service Definition Language (WSDL).
The example below shows how to apply QoS for a service via Developer Studio and deploy it in the server.
First deploy the service to the server and get the URI of the WSDL.
If you are using an Axis2Service Project, after creating the project, you can right click on the project and click Generate WSDL. Then in the WSDL Selector wizard, you can browse to the relevant wsdl file in the Browser workspace field as shown below.
Right click on the project where you want to apply QoS and click Apply QoS. A wizard appears where you can create a new QoS project. Give a name for the project and click Next.
Give the URI of the WSDL as shown below in the WSDL Selector wizard in the WSDL URI field. You can browse to a WSDL in the workspace or file system.
- 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. Click Finish.
Now you can see the created QoS project in the Project Explorer.
In the QoS editor that appears, under Service Info, you can enable security by selecting Yes from the combo box.
If you closed the QoS editor and want to open it again, right-click on the created QoS project and click Open with QoS.
After selecting the relevant options, click Save.
- If you click the UsernameToken basic scenario option under the Security for the service category, click User Roles to define the role details.
On the window that appears, fill in the relevant information. Make sure that the server is running at this time. Click Get Roles to select the specific roles. Once the roles are selected, click OK.
- If you click the Registry option under the Policy from Registry sub category, then click Browse from Registry.
On the dialog box that appears, click Registry. The Registry Browser appears where you can select the policy file. Click OK.
- If you click the UsernameToken basic scenario option under the Security for the service category, click User Roles to define the role details.
- A security policy file is created for the QoS project. To view the policy, expand the project's src\main\resources folder and double-click the file.
Create a Composite Application Project including the QoS project you created and then create a CAR file.
Deploy the created CApp in the server first. Then deploy the CAR.