+

Search Tips   |   Advanced Search

Implement policy sets for unmanaged clients

Policy sets can simplify the 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 creating policy sets or changing existing policy sets, first identify the security and other requirements of the web service.

We can use policy sets only with JAX-WS applications that run on the Axis2 web service engine. We cannot use policy sets for JAX-RPC applications.

Policy sets are assertions about how services are defined, and we 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, configure the policy sets manually to take advantage of them.

  1. Create a policy set, or export an existing policy set from the application server.

  2. Place the policy set files in the META-INF directory so they can be used by the unmanaged client.

    Avoid trouble: If we 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
             ...

  3. Create the clientPolicyAttachments.xml file, which references the policy sets to implement, and place it in the META-INF directory.

    1. 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>

    2. Verify that the clientPolicyAttachments.xml file is in the META-INF directory.

  4. Create an application specific or general client policy set binding that is compatible with the policy set. We 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 Define and manage policy set bindings. To export a binding from the application server:

    1. Select Services > Policy sets > General client policy set bindings

    2. Select the binding to export from the list.

    3. Click Export...

    4. Click the binding name to download the archive file.

  5. Place the binding files in the META-INF directory so they can be used by the unmanaged client.

    Avoid trouble: If we 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
           ...

  6. Verify that the location of the policy set and bindings are in the class path when you start the thin client. For example, we can specify the class path on the command line:

      java -cp policy_set/ my_client


Related concepts

  • Web services policy sets


    Related tasks

  • Manage policy sets using the administrative console
  • Define and manage policy set bindings