Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In CXF, elements attached to a wsdl element are available as extensors in the service model representation of that wsdl element: wsp:Policy and wsdp:PolicyReference elements can be obtained through the service model as extensors of type UnknownExtensibilityElement with matching element names (note that these attached elements are not parsed when the service model is built).
Policies attached to their subject through xml element attachment in WSDL 1.1 can therefore be obtained through the service model associated with an endpoint/an operation.

Infotip
titleUsing PolicyAttachment Documents

The location of documents containing PolicyAttachment documents on the other hand needs to be made known to the framework. This can easily be achived through configuration:

Code Block
java
java
<bean class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider">
    <constructor-arg ref="cxf"/>
    <property name="location" value="org/apache/cxf/systest/ws/policy/addr-external.xml"/>
</bean>

The location of the document containing PolicyAttachments is specified in the form of a classpath resource or URL. Any number of external attachment providers can be specified.

...

Additional aggregation takes place to determine the effective policy of an endpoint:
The effective policy for a service is the effective policy for the service subject.
The effective policy for an endpoint is the merge of the effective policies for the service subject and the endpoint subject.
The effective policy for an operation is the merge of the effective policies for the service subject, the endpoint subject and the operation subject.
The effective policy for a (input | output | fault) message is the merge of the effective policies for the service subject, the endpoint subject, the operation subject and the message subject.

Info
titleNote

...

Multiple sources can be used to supply policies applying to the same subject. In the case of

...

an endpoint subject for example,

...

its associated wsdl:port element

...

can have multiple wsp:Policy child elements. An additional external provider

...

can also contain multiple wsp:PolicyAttachment elements in which the AppliesTo children identify the

...

endpoint in question as the target subject. Both the Policies attached to the port element as well as

...

those in the matching PolicyAttachment elements will contribute to the effective policy of the endpoint subject.

...

It is also important to keep in mind that

...

the aggregation process described above makes it possible for an effective policy to have multiple assertion elements of the same type in one alternative (although this would not be considered the normal). Different assertions of the same

...

type within the same alternative do not overwrite each other.

...

Instead, they may contradict each other, but it is also possible that they complement each other. In any case, the framewwork will not remove such duplicates and instead leave it to the interceptors involved in the assertion process to decide if they can meaningfully interpret the existence of multiple assertions of the same type.

It is also obvious that the above aggregation process can be quite resource intense. Effective policies for messages and endpoints are therefore cached by the framework for future reference. The entity that manages the cache of effective policies is the PolicyEngine.

...