Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Service Development | Working with Web Services | Working with Policies | Attaching a Policy to a Web Service Descriptor
 
Attaching a Policy to a Web Service Descriptor
You can attach one or more policies to a single web service descriptor. Also, multiple web service descriptors can share the same policy. You can attach any policy that resides in the policy repository.
Keep the following points in mind when attaching policies to a web service descriptor:
*To attach a policy to a web service descriptor, the Pre-8.2 compatibility mode property of the web service descriptor must be set to false.
If you change the Pre-8.2 compatibility mode property of a web service descriptor from false to true after a policy is attached to it, the policy subject will no longer be governed by that policy.
For more information about Pre-8.2 compatibility mode property, see About Pre-8.2 Compatibility Mode.
*When attaching policies, avoid attaching a policy that contains policy assertions that Integration Server does not support. For information about supported assertions, see the Web Services Developer’s Guide. If you attach a policy that contains unsupported policy assertions, unexpected behavior may occur.
*If you attach a policy to a WSDL first provider web service descriptor or a consumer web service descriptor, the attached policy will override any annotated policy in the source WSDL.
*For a web service descriptor with a policy attached to it, the attached policy always takes precedence at run time.
*For a consumer web service descriptor, even though the consumer WSDL will not show the attached policy, Integration Server will enforce the attached policy at run time.
*When you attach a policy to or remove a policy from a provider web service descriptor, the WSDL generated for that web service descriptor is changed as well. Any web service clients generated from the WSDL will need to be regenerated.
*When you attach a policy to or remove a policy from a consumer web service descriptor, you do not need to refresh the web service connectors to pick up the policy change. Integration Server detects and enforces the policy change at run time.
*If the policy you are attaching contains WS-SecurityPolicy assertions and you also want to use MTOM streaming, be aware that if the fields to be streamed are also being signed and/or encrypted, Integration Server cannot use MTOM streaming because Integration Server needs to keep the entire message in memory to sign and/or encrypt the message.
*To attach a policy to a web service descriptor
1. In Package Navigator view, open and lock the web service descriptor to which you want to attach a policy.
2. In the Policies tab, click on the web service descriptor toolbar, or right-click and select Attach Policy.
3. Select the policies that you want to attach to the web service descriptor.
Designer displays the policies that you selected in the Policies tab.
4. Against each policy in the Policies tab, select the appropriate check boxes to attach a WS-Policy to Input, Output, and/or Fault message type. You can choose to attach a policy to all message types or to any of the three message types. You must select at least one message type for each policy in the Policies tab if you want the web service descriptor to be governed by that policy.
Note:
By default, all the three message types are selected.
5. Click File > Save.