Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 5. The WS-Policy Framework
Abstract
This chapter provides an introduction to the basic concepts of the WS-Policy framework, defining policy subjects and policy assertions, and explaining how policy assertions can be combined to make policy expressions.
5.1. Introduction to WS-Policy Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
Overview Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
The WS-Policy specification provides a general framework for applying policies that modify the semantics of connections and communications at runtime in a Web services application. Apache CXF security uses the WS-Policy framework to configure message protection and authentication requirements.
Policies and policy references Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
The simplest way to specify a policy is to embed it directly where you want to apply it. For example, to associate a policy with a specific port in the WSDL contract, you can specify it as follows:
An alternative way to specify a policy is to insert a policy reference element,
wsp:PolicyReference
, at the point where you want to apply the policy and then insert the policy element, wsp:Policy
, at some other point in the XML file. For example, to associate a policy with a specific port using a policy reference, you could use a configuration like the following:
Where the policy reference,
wsp:PolicyReference
, locates the referenced policy using the ID, PolicyID (note the addition of the #
prefix character in the URI
attribute). The policy itself, wsp:Policy
, must be identified by adding the attribute, wsu:Id="PolicyID"
.
Policy subjects Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
The entities with which policies are associated are called policy subjects. For example, you can associate a policy with an endpoint, in which case the endpoint is the policy subject. It is possible to associate multiple policies with any given policy subject. The WS-Policy framework supports the following kinds of policy subject:
Service policy subject Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
To associate a policy with a service, insert either a
<wsp:Policy>
element or a <wsp:PolicyReference>
element as a sub-element of the following WSDL 1.1 element:
wsdl:service
—apply the policy to all of the ports (endpoints) offered by this service.
Endpoint policy subject Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
To associate a policy with an endpoint, insert either a
<wsp:Policy>
element or a <wsp:PolicyReference>
element as a sub-element of any of the following WSDL 1.1 elements:
wsdl:portType
—apply the policy to all of the ports (endpoints) that use this port type.wsdl:binding
—apply the policy to all of the ports that use this binding.wsdl:port
—apply the policy to this endpoint only.
For example, you can associate a policy with an endpoint binding as follows (using a policy reference):
Operation policy subject Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
To associate a policy with an operation, insert either a
<wsp:Policy>
element or a <wsp:PolicyReference>
element as a sub-element of any of the following WSDL 1.1 elements:
wsdl:portType/wsdl:operation
wsdl:binding/wsdl:operation
For example, you can associate a policy with an operation in a binding as follows (using a policy reference):
Message policy subject Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
To associate a policy with a message, insert either a
<wsp:Policy>
element or a <wsp:PolicyReference>
element as a sub-element of any of the following WSDL 1.1 elements:
wsdl:message
wsdl:portType/wsdl:operation/wsdl:input
wsdl:portType/wsdl:operation/wsdl:output
wsdl:portType/wsdl:operation/wsdl:fault
wsdl:binding/wsdl:operation/wsdl:input
wsdl:binding/wsdl:operation/wsdl:output
wsdl:binding/wsdl:operation/wsdl:fault
For example, you can associate a policy with a message in a binding as follows (using a policy reference):