In general, WS-Policy is used for configuring WS-Security, WS WS-Reliable Messaging, caching, and throttling. WS-Policy Attachment attachment specification defines a set of policy subjects that can be used , when the user wants to attach or apply security policies. WSO2 Carbon based products have the power capability of Axis2 to apply WS-Policy for your to services at different levels such as service, service operation, service operation message, binding, binding operation, binding operation message, etc.The WS-Policy configuration functionality is provided by the Service Management feature of the WSO2 feature repository.
Defining
...
policies at
...
bindings
Policies can be applied at the binding hierarchy , at in three different policy subjects such as:
...
A policy to SOAP 1.1 and SOAP 1.2 bindings at Binding binding level can be defined in the services.xml by adding the following code (see also The The WS-Policy Editor below).
Code Block | ||
---|---|---|
| ||
<wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> <wsp:AppliesTo> <policy-subject identifier="binding:soap11" /> <policy-subject identifier="binding:soap12" /> </wsp:AppliesTo> <wsp:Policy wsu:Id="binding_level_policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> </wsp:Policy> </wsp:PolicyAttachment> |
For the Binding Operation level, the <wsp:AppliesTo> element is used to define the scope of the policy. The An XML snippet is as follows:
...
The configuration is similar for the Binding Message level for the out message. The identifier attribute of the the <policy-subject/>
element in element in <wsp:AppliesTo>
changes to changes to binding:soap11/operation:echo/out.
The The XML snippet is as follows:
Code Block | ||
---|---|---|
| ||
<wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> <wsp:AppliesTo> <policy-subject identifier="binding:soap11/operation:secureEcho/in" /> <policy-subject identifier="binding:soap12/operation:secureEcho/in" /> </wsp:AppliesTo> <wsp:Policy wsu:Id="binding_level_policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> </wsp:Policy> </wsp:PolicyAttachment> |
Info | ||
---|---|---|
| ||
Further details can be found in these articles hosted on WSO2 Oxygen Tank:Infor: For more information on WS-Policy, see |
...
WS-Policy
...
editor
The You can use either the graphical or text WS-Policy Editor allows editor to edit WS-Policy documents using either a graphical editor or a plain text editoryour policy documents. Given a Service service or a Modulemodule, it will generate generates a graphical tree view (the " Policy " tree) representing the document along with the plain text (Raw Policyraw policy) representation. The default view presented is the source view or the raw policy.
...
Note:
You will be editing the merged WS-Policy, which includes all the WS-Policy components attached to the particular level selected.
The WS-Policy Editor also contains a "Design Viewdesign view, " which provides is a graphical representation of the WS-Policy in questionbeing edited. For example,
Using the Policy Editor
Here are few tips to use the policy editor:
- Right-click on any node in the " Policy " tree - A shortcut menu appears. You can add new elements and delete existing ones. The plain text representation will be kept in sync with the changes done using the " Policy " tree, and vise versa.
- Selecting an element in the " Policy " tree - Allows to edit the attributes of that policy element. Similarly, when adding an element, you will be prompted to add data to the attributes relevant to that particular element.
- Save Policy - Once you have finished editing your policy document, click "click Save Policy."
- Go Back - Click "Click Go Back" to to go back to the previous page.
...
hidden | true |
---|
...
- .