cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > WSPConfiguration
Date Wed, 09 Jan 2013 10:17:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/WSPConfiguration">WSPConfiguration</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~coheigea@apache.org">Colm
O hEigeartaigh</a>
    </h4>
        <br/>
                         <h4>Changes (7)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h1. WS-Policy Framework Configuration
<br> <br></td></tr>
            <tr><td class="diff-changed-lines" >CXF&#39;s WS-Policy Framework
is described in more detail in the [WS-Policy Framework User&#39;s Guide |WS-Policy].
Like many other features in CXF, the implementation is interceptor based, and thus the computation
of the effective policy for a specific message <span class="diff-changed-words"><span
class="diff-added-chars"style="background-color: #dfd;">(</span>as</span> well
as the verification that one of the alternatives of that effective policy is <span class="diff-changed-words">supported<span
class="diff-added-chars"style="background-color: #dfd;">)</span> happen<span class="diff-added-chars"style="background-color:
#dfd;">s</span></span> in interceptors. As there are quite a number of interceptors
involved, these are not normally on the interceptor chains, i.e. the WS-Policy Framework is
disabled. To enable it, use any of the following options: <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h2. Using the Policies
Feature <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >In addition, the element can have
any number of Policy or PolicyReference child elements. This has the same effect as if the
Policy or PolicyReference elements were attached to the wsdl:port element of the wsdl contract
of the client or server endpoint to which the feature is applied (or to all endpoints if the
feature is applied to the bus).  <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >For example, to apply this feature
to <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">a</span>
the bus and prevent exceptions being thrown when encountering unknown assertions: <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:xml} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h2. Configuring the Policy Engine
<br> <br></td></tr>
            <tr><td class="diff-changed-lines" >The policy engine is the central
instance of the WS-Policy framework implementation. You can enable and configure it directly,
using the &lt;engine&gt; element in the <span class="diff-added-words"style="background-color:
#dfd;">http://cxf.apache.org/policy namespace. This element supports the same attributes
and child elements as the &lt;policies&gt; element above, except:</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">http://cxf.apache.org/policy
namespace. This element supports the same attributes and child elements as the &lt;policies&lt;
element&gt; above, except: <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >* It supports the additional attribute
<span class="diff-changed-words"><span class="diff-added-chars"style="background-color:
#dfd;">&#39;</span>enabled<span class="diff-added-chars"style="background-color:
#dfd;">&#39;</span></span> of type boolean (default: false) to determine
if the engine, and hence the policy framework, is enabled. <br></td></tr>
            <tr><td class="diff-unchanged" >* It ignores Policy and PolicyReference
child elements. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Following</span>
<span class="diff-added-words"style="background-color: #dfd;">The following</span>
configuration achieves the same as in the example above: <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:xml} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >*Note:* Starting with CXF 2.2,
the Policy Engine defaults to enabled=true and ignoreUnknownAssertions=true. <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">
</span> Thus, the above configuration is no-longer needed as that is the default. <br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="WSPConfiguration-WSPolicyFrameworkConfiguration"></a>WS-Policy
Framework Configuration</h1>

<p>CXF's WS-Policy Framework is described in more detail in the <a href="/confluence/display/CXF20DOC/WS-Policy"
title="WS-Policy">WS-Policy Framework User's Guide </a>. Like many other features
in CXF, the implementation is interceptor based, and thus the computation of the effective
policy for a specific message (as well as the verification that one of the alternatives of
that effective policy is supported) happens in interceptors. As there are quite a number of
interceptors involved, these are not normally on the interceptor chains, i.e. the WS-Policy
Framework is disabled. To enable it, use any of the following options:</p>

<h2><a name="WSPConfiguration-UsingthePoliciesFeature"></a>Using the Policies
Feature</h2>

<p>The policies feature element is defined in namespace <a href="http://cxf.apache.org/policy"
class="external-link" rel="nofollow">http://cxf.apache.org/policy</a>. It supports
two attributes:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Value </th>
</tr>
<tr>
<td class='confluenceTd'> ignoreUnknownAssertions</td>
<td class='confluenceTd'> Indicates an exception should be thrown when encountering
assertions for which no AssertionBuilders are registered (default: true). When set to false,
a warning will be logged instead. </td>
</tr>
<tr>
<td class='confluenceTd'> namespace</td>
<td class='confluenceTd'> The namespace of the WS-Policy Framework specification (default:

<a href="http://www.w3.org/ns/ws-policy" class="external-link" rel="nofollow">http://www.w3.org/ns/ws-policy</a>
<p>). </p></td>
</tr>
</tbody></table>
</div>


<p>The element also support the the following child elements:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Value </th>
</tr>
<tr>
<td class='confluenceTd'> alternativeSelector</td>
<td class='confluenceTd'> A bean or reference to a bean that implements the org.apache.cxf.ws.policy.selector.AlternativeSelector
interface. The default selector chooses the minimal alternative, i.e. the one with the least
number of assertions.  </td>
</tr>
</tbody></table>
</div>


<p>In addition, the element can have any number of Policy or PolicyReference child elements.
This has the same effect as if the Policy or PolicyReference elements were attached to the
wsdl:port element of the wsdl contract of the client or server endpoint to which the feature
is applied (or to all endpoints if the feature is applied to the bus). </p>

<p>For example, to apply this feature to the bus and prevent exceptions being thrown
when encountering unknown assertions:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;beans xmlns=<span class="code-quote">"http://www.springframework.org/schema/beans"</span>
       <span class="code-keyword">xmlns:cxf</span>=<span class="code-quote">"http://cxf.apache.org/core"</span>
       <span class="code-keyword">xmlns:p</span>=<span class="code-quote">"http://cxf.apache.org/policy"</span>
       <span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
       xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
    <span class="code-tag">&lt;cxf:bus&gt;</span>
        <span class="code-tag">&lt;cxf:features&gt;</span>
            <span class="code-tag">&lt;p:policies ignoreUnknownAssertions=<span
class="code-quote">"true"</span>/&gt;</span>
        <span class="code-tag">&lt;/cxf:features&gt;</span>
    <span class="code-tag">&lt;/cxf:bus&gt;</span>
<span class="code-tag">&lt;/beans&gt;</span>
</pre>
</div></div>

<h2><a name="WSPConfiguration-ConfiguringthePolicyEngine"></a>Configuring
the Policy Engine</h2>

<p>The policy engine is the central instance of the WS-Policy framework implementation.
You can enable and configure it directly, using the &lt;engine&gt; element in the
<a href="http://cxf.apache.org/policy" class="external-link" rel="nofollow">http://cxf.apache.org/policy</a>
namespace. This element supports the same attributes and child elements as the &lt;policies&gt;
element above, except:</p>

<ul>
	<li>It supports the additional attribute 'enabled' of type boolean (default: false)
to determine if the engine, and hence the policy framework, is enabled.</li>
	<li>It ignores Policy and PolicyReference child elements.</li>
</ul>


<p>The following configuration achieves the same as in the example above:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;beans xmlns=<span class="code-quote">"http://www.springframework.org/schema/beans"</span>
       <span class="code-keyword">xmlns:cxf</span>=<span class="code-quote">"http://cxf.apache.org/core"</span>
       <span class="code-keyword">xmlns:p</span>=<span class="code-quote">"http://cxf.apache.org/policy"</span>
       <span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
       xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;

    <span class="code-tag">&lt;p:engine enabled=<span class="code-quote">"true"</span>
ignoreUnknownAssertions=<span class="code-quote">"true"</span>/&gt;</span>
<span class="code-tag">&lt;/beans&gt;</span>      
</pre>
</div></div>

<p><b>Note:</b> Starting with CXF 2.2, the Policy Engine defaults to enabled=true
and ignoreUnknownAssertions=true. Thus, the above configuration is no-longer needed as that
is the default.</p>


<h2><a name="WSPConfiguration-SpecifyingtheLocationofExternalAttachments"></a>Specifying
the Location of External Attachments</h2>

<p>To specify the location of an external attachment that the policy framework should
take into consideration when aggregating the policies applying to a specific message, you
can use the &lt;externalAttachment&gt; element in the same namespace. It supports
the following attributes:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Value </th>
</tr>
<tr>
<td class='confluenceTd'> location</td>
<td class='confluenceTd'> Location of the external attachment document. This takes the
form of a <a href="http://static.springframework.org/spring/docs/2.0.x/reference/resources.html"
class="external-link" rel="nofollow">Spring Resource </a> type property, e.g. classpath:etc/policies.xml
or 
<a href="file:/x1/resources/polcies.xml" class="external-link" rel="nofollow">file:/x1/resources/polcies.xml</a>
<p>. </p></td>
</tr>
</tbody></table>
</div>


<p>Example:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
    <span class="code-tag">&lt;p:externalAttachment location=<span class="code-quote">"classpath:org/apache/cxf/systest/ws/policy/addr-external.xml"</span>/&gt;</span>
</pre>
</div></div>

<p>You can have any number of &lt;externalAttachment&gt;  elements in your configuration
file.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/WSPConfiguration">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=63526&revisedVersion=11&originalVersion=10">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/WSPConfiguration?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message