 | 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.
-
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.
-
Click the Browse… button and choose the HelloWorldPolicySet.zip file that you exported to c:\temp above.
-
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
-
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.
-
Click the Browse… button and choose the HelloWorldProviderBindings.zip file that you exported to c:\temp above.
-
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
Once the policy set and bindings have been imported into Rational Application Developer, you can attach them to the service provider.
-
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
-
Click the Add button add a policy set and binding to an endpoint.
-
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
-
Click the OK button to save this association.
-
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:
-
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)
-
Ensure Run server with resources on Server is selected in the Publishing settings for WebSphere Application Server section.
- 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.
-
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
Now that the project has been removed, you will add it back, which will cause a fresh deploy.
-
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.
-
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
-
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.
-
Login to the admin console and select Services > Services providers. You should see the HelloWorldProviderService listed in the service providers.
-
Click the HelloWorldProviderService to drill into this service.
-
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)
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:
-
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)
-
If security was not enabled before, you need to restart WebSphere Application Server for the security settings to take effect.
|  |