Skip to main content

skip to main content

developerWorks  >  WebSphere | SOA and Web services | Rational  >

Message-level security with JAX-WS on WebSphere Application Server v7

Using Rational Application Developer 7.5.2 to build secure JAX-WS Web services

developerWorks
Go to the previous pagePage 5 of 12 Go to the next page

Document options
PDF format - Fits A4 and Letter

PDF - Fits A4 and Letter
2742 KB (58 pages)

Get Adobe® Reader®

Sample code


My developerWorks needs you!

Connect to your technical community


Rate this tutorial

Help us improve this content


Section 5. Securing the service provider

Now that you have created a custom policy set and policy set binding (which you exported to c:\temp) you need to import them into the HelloWorldProject to attach them to the service provider. Recall that policy sets provide a declarative way to provide qualities of service (QoS) for Web services. By attaching a policy set and binding to a Web service, you are declaratively specifying what QoS to use.

  1. From the main menu of Rational Application Developer choose File > Import > Web services > WebSphere Policy Sets. Now click the Next button, which displays a dialog box like the one in Figure 31.

  2. Click the Browse… button and choose the HelloWorldPolicySet.zip file that you exported to c:\temp above.

  3. The wizard reads the zip file and lists the policy sets included in the file. Click the checkbox next to HelloWorldPolicySet, then click the Finish button.

    Figure 31. Import policy set
    Screen shot of Policy Set Import Wizard

  4. As in the steps above, right-click HelloWorldProject and choose Import > Import > Web services > WebSphere Named Bindings. Now click the Next button, which displays a dialog box like the one in Figure 32.

  5. Click the Browse… button and choose the HelloWorldProviderBindings.zip file that you exported to c:\temp above.

  6. Again, the wizard reads the zip file and list the policy set bindings included in the file. Click the checkbox next to HelloWorldProviderBindings, then click the Finish button.

    Figure 32. Import policy set bindings
    Screen shot of Named Binding Import Wizard

    Once the policy set and bindings have been imported into Rational Application Developer, you can attach them to the service provider.

  7. In Rational Application Developer, drill into the HelloWorldProject > Services > {http://dwexample.ibm.com}HelloWorldProviderService then right-click and choose Manage policy set attachment… as shown in figure 33:

    Figure 33. Attaching policy set and bindings
    Screen shot of Manage Policy Set Attachment option

  8. Click the Add button add a policy set and binding to an endpoint.

  9. Leave the scope set to the entire service and choose HelloWorldPolicySet from the drop-down for the policy set and HelloWorldProviderBindings from the drop-down for the binding as shown in figure 34.

    Figure 34. Customizing policy set bindings
    Screen shot of End Point Definition Dialog

  10. Click the OK button to save this association.

  11. Click the Finish button to close the policy set attachment dialog box.

Now that you have attached the policy set and bindings to the service provider, you will deploy the service provider onto the WebSphere Application Server runtime and verify that our policy set and bindings have been attached.

There are a variety of ways to deploy the service provider onto the WebSphere Application Server, but in this tutorial we will use the Add and Remove Projects… menu item available in the Rational Application Developer Servers view.

To deploy the service provider:

  1. Right-click WebSphere Application Server v7.0 at localhost (or whatever your server is called if different) and choose Open. This will bring up the server configuration settings page as shown in Figure 35.

    Figure 35. WebSphere Application Server v7.0 server configuration (see enlarged Figure 35)
    Screen shot of server configuration tab

  2. Ensure Run server with resources on Server is selected in the Publishing settings for WebSphere Application Server section.

  3. Save and close the server configuration file.

    The Run server with resource on Server setting will ensure that the policy set and bindings attachment show up in the WebSphere Application Server Administrative Console.

    In order to ensure a clean deploy, you will remove the HelloWorldProjectEAR from the server, then re-add it.

  4. Right-click the HelloWorldProjectEAR project under WebSphere Application Server v7.0 at localhost in the Servers view and choose Remove as shown Figure 36.



    Figure 36. Remove HelloWorldProjectEAR from server
    Screen shot of Remove option

    Now that the project has been removed, you will add it back, which will cause a fresh deploy.

  5. Right-click WebSphere Application Server v7.0 at localhost (or whatever your server is called if different) and choose Add and Remove Projects… as shown in Figure 37.

  6. Click the HelloWorldProjectEAR project from the Available projects field and click the Add > button to move it to the Configured projects field then click the Finish button.

    Figure 37. Deploy Service Provider to WebSphere Application Server
    Screen shot showing meny options to Add the project to the configured projects

  7. When the server finishes deploying and publishing, use the Administrative Console to verify that the service provider was successfully deployed to WebSphere Application Server and that the policy set and bindings have been attached. Once again right-click WebSphere Application Server v7.0 at localhost, but this time choose Administration > Run Administrative console.

  8. Login to the admin console and select Services > Services providers. You should see the HelloWorldProviderService listed in the service providers.

  9. Click the HelloWorldProviderService to drill into this service.

  10. You should now see the HelloWorldPolicySet attached as the policy set and HelloWorldProviderBindings attached for the binding as shown in Figure 38.

    Figure 38. Verify policy set and bindings attached (see enlarged Figure 38)
    Screen shot of window to manage HelloWorldProviderService policy sets and bindings

If you do not see the HelloWorldProviderService in the service providers window, then logout of the Adminstrative Console and then log back in to refresh the console such that you see the policy set and bindings attached to the service provider as shown in Figure 38.

Since you copied the Username WSSecurity default policy set, this policy set defines authentication through the username token. As a result, you need to enable security on the WebSphere Application Server server such that authentication can occur.

To enable security on WebSphere Application Server:

  1. In the Administrative Console, navigate to Security > Global security and verify that Enable administrative security and Enable application security are selected as shown in Figure 39.

    Figure 39. Enable application security (see enlarged Figure 39)
    Screen shot of Global security window

  2. If security was not enabled before, you need to restart WebSphere Application Server for the security settings to take effect.


Back to top



Go to the previous pagePage 5 of 12 Go to the next page