The Web Services Policy Framework (WS-Policy) provides a standard mechanism to express the capabilities, requirements, and general characteristics of a Web service as policies. A service provider uses a policy to convey conditions under which it provides services to a Web service client. The information shared by the Web service through a policy can be used by the client to determine how to communicate with the Web service.
IBM® Rational® Application Developer Version 7.5 enables a Web service provider that uses IBM® WebSphere® Application Server V7.0 to share the policy configuration with the client in two ways:
- Share Policy Configuration in a published WSDL (Web Services Description Language) file or a WSDL file acquired through an HTTP
GETrequest. - Share Policy Configuration in a WSDL file acquired via WS-MetadataExchange GetMetadata request.
A Web service uses metadata, such as WSDL, an XML schema, and WS-Policy, to describe what a Web service client needs to interact with the Web service. To communicate effectively with a Web service, it is important for a Web service client to retrieve the metadata. WS-MetadataExchange, a Web service specification, defines a standard way to encapsulate the metadata of a Web service. It also specifies mechanisms for the retrieval of metadata (for example: GetMetdata).
The advantage of using WS-MetadataExchange over an HTTP GET request is the ability to securely share policy configuration with the Web service client. To learn more about WS-MetadataExchange, see the WS-MetadataExchange specification, which is cited in the Resources section.
A policy set is a collection of policies that provides qualities of protection for Web services. For example, the WebSphere Application Server V7.0 WS-I (RSP Reliable Secure Profile) policy set (see Resources) consists of WS-Security, WS-Addressing, and WS-ReliableMessaging policy types. These policy types (in combination or on their own) provide the following qualities of protection:
- Reliable message delivery to the intended receiver in the presence of software, system, or network failure by enabling WS-ReliableMessaging.
- Message confidentiality through encryption that includes encrypting the message body and signature elements using WS-Security and WS-SecureConversation (an extension of WS-Security).
- Message integrity (ensuring that messages have originated from an appropriate sender and were not modified during transmission) through digital signature that includes signing the message body, time stamp, WS-Addressing and WS-ReliableMessaging headers using WS-Security and WS-SecureConversation. The WS-Addressing headers allow uniform addressing of messages to and from the Web service in a transport-independent way.
WebSphere Application Server V7.0 provides several policy set templates that you can tailor to your requirements. This article demonstrates using the WS-Policy support in Rational Application Developer V7.5 by applying WS-I RSP policy set to a Web service provider and client.
The details of WS-Policy and the various policy specifications are beyond the scope of this article. However, see Resources for a link to further details.
Benefits of Web services framework (WS-Policy)
WS-Policy enables a Web service client to communicate with the Web service provider yet minimizes out-of-band information. This information (such as paper notes and e-mail exchanges between software developers) is required for applications to communicate with each other under actual business conditions, such as security and reliability. Consider the following example in the absence of WS-Policy.
The WS-I RSP policy set enables secure and reliable message transmission between a Web service provider and client. The IT department of a multinational bank wants to host a Web service from its global headquarters in New York. Due to the sensitive data that a banking business transmits, the Web service provider in New York equips the Web service with the WS-I RSP policy set. Each of the bank's regional headquarters runs a Web service client that is configured to communicate with the Web service hosted in New York.
If the Web service in New York is altered to use a different policy set, then the Web service application provider in New York has to send a notice containing configuration information to each of its clients. However, if the Web service provider and the client were to use the WS-Policy framework, they would not have to exchange policy configuration information through manual means such as e-mail exchanges, because the new policy configuration would have been shared by the Web service provider automatically using the WS-Policy framework.
Add the WS-I RSP policy set to the JAX-WS Web service
Prerequisite:To follow the example in this article, you need Rational Application Developer V7.5 installed with at least the WebSphere V7.0 test server.
- Download the simpleProject.zip file from the Downloads section into your file system. This file is a project interchange file that contains a simple Web service and a Web service client.
- Launch Rational Application Developer by selecting Programs > IBM Software Delivery Platform > IBM Rational Application Developer 7.5 > IBM Rational Application Developer from the start menu.
- Import the project into Rational Application Developer as shown in Figures 1, 2, and 3 by clicking File > Import > other > Project Interchange.
Figure 1. Import
Figure 2. Import the Project Interchange file
- In the From zip file text box, enter the name of the file that you want to import, as shown in Figure 3. This will be the absolute path of the simpleProject.zip file that you downloaded in Step 1.
Figure 3. Import Projects dialog
- Click Select All and then click Finish.
- This previous operation imports a Web service, a Web service client, and the corresponding EAR (enterprise archive) files that hold the service project and client project.
Deploy projects to WebSphere Application Server V7.0
- Start the WebSphere Application Server V7.0 by right-clicking WebSphere Application Server V7.0 at localhost in the server editor and selecting Start, as shown in Figure 4.
Figure 4. Start the server
- Add the Web service and Web service client projects to the WebSphere Application Server V7.0 by right clicking WebSphere Application Server V7.0 at localhost in the server editor and selecting Add and Remove Projects, as shown in Figure 5.
Figure 5. Add and Remove Projects command
- Select Add All and click Finish, as shown in Figure 6. This will deploy the Web service and Web service client on the WebSphere Application Server V7.0
Figure 6. Add All projects
Attach the WS-I RSP policy set to the Web service provider
- Click the Services Tab, which is adjacent to the Enterprise Explorer tab, as Figure 7 shows.
Figure 7. Services view
- Right-click HelloWorldService under the JAX-WS (the Java API for XML Web Services) node and select Manage Policy Set Attachment (Figure 8).
Figure 8. Manage Policy Set Attachment command
- The application table will be empty (as shown in Figure 9) indicating that the simpleWebServiceProjectEAR application does not have any policy set attached to it. Click the Add button to add a policy set to the Web service contained in the simpleWebServiceProjectEAR application.
Figure 9. Service Side Policy Set Attachment view
- Ensure that the settings shown in Figure 10 are set in your endpoint definition dialog:
- Service Name: simpleWebServiceProject.war:{http://test/}HelloWorldService
- Endpoint: <all endpoints>
- Policy Set: WS-I RSP
- Binding: Provider sample
Figure 10. End Point Definition Dialog window
- Click OK and then click Ignore All on the warning dialog. The WS-I RSP policy set is now attached to simpleWebServiceProjectEAR's HelloWorldService, as indicated in the Add Policy Set Attachment to Service page. The settings that you selected previously are now visible in the table, as shown in Figure 11.
Figure 11. Add Policy Set Attachment to Service dialog
The WS-I RSP policy set that you attached to the HelloWorldService must be shared with the Web service client. You will do this by following Steps 16 through 20.
- Click the Next button to move to the Configure Policy Sharing page.
- Click the Configure button on Configure Policy Sharing dialog, as shown in Figure 12.
Figure 12. Service Side Policy Set – Configure Policy Sharing dialog
- You will be presented with two options for sharing the policy configuration. For this exercise, select the option to Share Policy Information via WSDL (Figure 13). This option allows a service to share policy configuration in a WSDL file acquired through an HTTP
GETrequest.
Figure 13. Configure Policy Sharing dialog
- Click OK. The configure policy sharing dialog should indicate that the HelloWorldService is sharing the policy.
- Click Finish. You have now configured the Web service provider to share the policy set configuration in a WSDL file acquired through an HTTP
GETrequest. To fully exploit the WS-Policy feature, you need to enable the Web service client to acquire the Web service provider policy set configuration. You will do that in Steps 1-5.
Acquire the WSDL file with the policy configuration
- Select the Services Tab adjacent to the Enterprise Explorer tab (see Figure 7), and then right-click HelloWorldService under the JAX-WS node to select Show > WSDL Interface, as shown in Figure 14. The Show > WSDL Interface command acquires the WSDL file through the HTTP
GETrequest mechanism that was discussed in the introduction to this article.
Figure 14. Show the WSDL interface
- Click the Source tab at the bottom-left corner of the WSDL editor (see Figure 15).
Figure 15. WSDL editor Source tab
The policy configuration is embedded in the <wsp:Policy> tags of the WSDL, which you should be able to see now.
Listing 1 shows a snippet of the WSDL that contains that <wsp:Policy> tags.
Listing 1. <wsp:Policy> tags in the WSDL code
<addressing:Addressing xmlns:addressing="http://www.w3.org/2007/05/addressing/metadata">
lt;wsp:Policy>
<wsp:ExactlyOne>
<wsp:All>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</addressing:Addressing>
|
Attach the WS-I RSP policy set to the Web service client
- Go to the Services view, right-click the HelloWorldService client under the client node, and then select Manage Policy Set Attachment.
Figure 16. Services view
- Highlight <all services> and then select Use Provider Policy, as shown in Figure 17. Highlighting <all services> ensures that each of the service clients in the simpleWebClientEAR will be configured to acquire provider policy.
Figure 17. Configure Policy Acquisition for Web Service Client dialog
- Because you configured the Web service provider to share policy configuration in a WSDL file acquired through an HTTP
GETrequest, the corresponding Web service client must be configured to use an HTTPGETrequest to receive the WSDL that contains the policy configuration from the provider. Therefore, select HTTP Get request targeted at, as Figure 18 shows.
Figure 18. Configure Provider Policy Acquisition dialog
- Click OK.
- Click Finish. You have now configured the Web service client to acquire the policy configuration from the Web service provider.
Examine the policy control files
- In the Enterprise Explorer tab, expand simpleWebServiceProjectEAR > META-INF and simpleWebClientEAR > META-INF.
- Double-click the files highlighted in Figure 19 (
wsPolicyServiceControl.xmlandwsPolicyClientControl.xml).
Figure 19. Policy Client Control and Policy Service Control files
The wsPolicyServiceControl.xml file indicates that the policy configuration will be shared through WSDL acquired via an HTTP GET request, as shown in the following tag pair:
<ExportPolicySetConfigurationInWSDL>true</ExportPolicySetConfigurationInWSDL> |
The wsPolicyClientControl.xml file indicates that the policy configuration will be acquired through WSDL by using an HTTP GET request, as shown in the following two tag pairs:
<ProviderPolicyAcquisition> <PolicyAcquisitionClass>com.ibm.ws.wspolicy.acquisition. AcquireViaQWSDL</PolicyAcquisitionClass> </ProviderPolicyAcquisition> |
You now know how to use the functionality in Rational Application Developer to configure WebSphere Application Server V7.0 policy sets and share them by using the WS-Policy framework.
The author thanks Yen Lu and Zina Mostafia for their diligent review of this article.
| Description | Name | Size | Download method |
|---|---|---|---|
| Simple Project | simpleProject.zip | 51KB | HTTP |
Information about download methods
Learn
- Learn more about WS-Policy and the various policy types.
- Read the WS-MetadataExchange specification.
- Read the WS-I RSP policy.
- Learn more about how Rational Application Developer for WebSphere Software extends Eclipse with visual development features.
- For technical resources, visit the Rational Application Developer area on developerWorks, where you will find technical documentation, how-to articles, downloads, and product information.
- Discover more about WebSphere Application Server V7.0 on the IBM WebSphere marketing Web site.
- Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
- Subscribe to the IBM developerWorks newsletter, a weekly update on the best of developerWorks tutorials, articles, downloads, community activities, webcasts and events.
- Subscribe to the Rational Edge newsletter for articles on the concepts behind effective software development.
- Read Tackling the challenges of software development with Rational Application Developer for WebSphere Software by Lee Ackerman and S. Mahate to find out more about how Rational Application Developer V7.5 can help you deliver Web and service-oriented applications (IBM developerWorks, September 2008).
Get products and technologies
- Download trial versions of IBM Rational software.
- Download these IBM product evaluation versions and get your hands on application development tools and middleware products from DB2®, Lotus®, Tivoli®, WebSphere®, and Rational®.
Discuss
- Check out developerWorks blogs and get involved in the developerWorks community.
- Join the Rational Application Developer forum on developerWorks.

Rakan Khalid is a Cognos Solution Architect at the IBM Software Group. Rakan holds a BSc in Computer Science with First Class Honours from York University. He has worked on a broad spectrum of IBM software products including DB2 Database Management System, WebSphere Application Server, and Rational Application Developer as the Web Services Function Test Lead. In his current role as a Cognos Solution Architect, Rakan is responsible to strategise and build competitive technological and business solutions to win clients in the business intelligence software landscape.
Comments (Undergoing maintenance)





