Policy sets can simplify your quality of service configuration
for web services by combining configuration settings for services
like addressing, messaging, and security. To use policy sets in an
unmanaged client, structure the policy sets in a way that is consumable
by the client on the command-line invocation.
Before you begin
Before creating policy sets or changing existing policy sets,
first identify the security and other requirements of the web service.
Note: You
can use policy sets only with JAX-WS applications that run on the
Axis2 web service engine. You cannot use policy sets for JAX-RPC applications.
About this task
Policy sets are assertions about how services are defined,
and you can use them to control web services at the application or
system level. Policy sets can be maintained through the application
server for deployed services, but if you are using a thin client,
which is unmanaged, you must configure the policy sets manually to
take advantage of them.
Procedure
- Create a policy set, or export an existing policy set from
the application server.
- For a new policy set, create the policy set files through
scripting or the administrative console. For more information about
managing web services policy sets, see the Managing policy sets using the administrative console topic.
- To export an existing policy set:
- Select
- Select the policy set that you want to export from the list.
- Click Export...
- Click the policy set name to download the archive file.
- Place the policy set files in the META-INF directory so
they can be used by the unmanaged client.
Avoid trouble: If you exported a policy set from the application
server, you must extract the policy set files from the archive, and
place them in the META-INF directory.
gotcha
The following
is an example of the file structure of a policy set collection: -META-INF
-PolicySets
-policy_set1
policySet.xml
-PolicyTypes
-policy_type1
policy.xml
-policy_type2
policy.xml
-policy_set2
...
- Create the clientPolicyAttachments.xml file, which references
the policy sets that you want to implement, and place it in the META-INF
directory.
- Create the clientPolicyAttachments.xml file in Rational
Application Developer or another development tool. The
following sample is an example of a clientPolicyAttachments.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<psa:PolicySetAttachment
xmlns:psa="http://www.ibm.com/xmlns/prod/websphere/200605/policysetattachment"
xmlns:ps="http://www.ibm.com/xmlns/prod/websphere/200605/policyset">
<psa:PolicySetReference name="policy_set1" id="1342">
<psa:Resource pattern="WebService:/">
</psa:Resource>
</psa:PolicySetReference>
</psa:PolicySetAttachment>
- Verify that the clientPolicyAttachments.xml file is
in the META-INF directory.
- Create an application specific or general client policy
set binding that is compatible with the policy set. You
can export a general binding from the application server, or use a
development tool like Rational Application Developer to create an
application-specific binding. For more information about bindings,
see Defining and managing policy set bindings. To export
a binding from the application server:
- Select
- Select the binding that you want to export from the list.
- Click Export...
- Click the binding name to download the archive file.
- Place the binding files in the META-INF directory so they
can be used by the unmanaged client.
Avoid trouble: If
you exported bindings from the application server, you must extract
the files from the archive, and place them in the META-INF directory.
gotcha
The file structure differs if you are using general bindings
or application-specific bindings:
- Here is an example of a set of general bindings, which are in
the bindings subdirectory:
-META-INF
-bindings
-binding1
bindingDefinition.xml
-PolicyTypes
-policy_type1
bindings.xml
-policy_type2
bindings.xml</p><p>
-binding2
...
- Here is an example of an application-specific binding, for which
there is no bindings subdirectory:
-META-INF
-binding1
bindingDefinition.xml
-PolicyTypes
-policy_type1
bindings.xml
-policy_type2
bindings.xml
-binding2
...
- Verify that the location of the policy set and bindings
are in the class path when you start your thin client. For
example, you can specify the class path on the command line:
java -cp policy_set/ my_client