cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dennis Sosnoski (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache CXF Documentation > WSRMConfiguration
Date Thu, 04 Jul 2013 02:22:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/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/WSRMConfiguration">WSRMConfiguration</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~dsosnoski">Dennis
Sosnoski</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        Added WS-ReliableMessagingPolicy 1.2 support description.<br />
    </div>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">As
of CXF 3.0.0 both the older WS-ReliableMessagingPolicy 1.0 (submission version) and the official
WS-ReliableMessagingPolicy 1.2 are supported. WS-ReliableMessagingPolicy 1.2 must be used
in the policy if you want WS-ReliableMessaging 1.2 support at runtime. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h2. Using the Reliable Messaging Feature
<br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="WSRMConfiguration-UsingWSReliableMessaging"></a>Using
WS-Reliable Messaging</h1>

<p>To make a message exchange between two endpoints reliable, you need to ensure that
the RM interceptors and (as WS-Reliable messaging has a dependency on WS-Addressing) the addressing
interceptors are added to the interceptor chains. This can be achieved in one of the following
ways:</p>

<h2><a name="WSRMConfiguration-UsingtheRMAssertionandtheCXFWSPolicyFramework"></a>Using
the RMAssertion and the CXF WS-Policy Framework </h2>
<p>If</p>
<ol>
	<li>A Policy with an RMAssertion element is attached to the wsdl:service element (or
any other wsdl element that according to the rules for WS-Policy Attachment is an attachment
point for Policy or PolicyReference elements)</li>
	<li>The CXF WS-Policy Framework is enabled</li>
</ol>


<p>the RM interceptors will be automatically added to their respective interceptor chains
by the policy framework. The assertion attributes control the behavior of the source/destination.
</p>

<p>For example, to enable the WS-Policy Framework on the server side, you configuration
file could look like this:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;jaxws:endpoint ...&gt;
    &lt;jaxws:features&gt;
        &lt;p:policies/&gt;
    &lt;/jaxws:features&gt;
&lt;/jaxws:endpoint&gt;
</pre>
</div></div>

<p>and your wsdl:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
    &lt;wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata"&gt;
        &lt;wsp:Policy/&gt;
    &lt;/wsam:Addressing&gt;
    &lt;wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"&gt;
        &lt;wsrmp:BaseRetransmissionInterval Milliseconds="10000"/&gt; 
    &lt;/wsrmp:RMAssertion&gt;
&lt;/wsp:Policy&gt;
...
&lt;wsdl:service name="ReliableGreeterService"&gt;
    &lt;wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort"&gt;
        &lt;soap:address location="http://localhost:9020/SoapContext/GreeterPort"/&gt;
        &lt;wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/&gt;
       
    &lt;/wsdl:port&gt;
&lt;/wsdl:service&gt;
</pre>
</div></div>

<p>Instead of attaching the PolicyReference attached to the wsdl:port element, you can
also specify it as a child element of the policies features, e.g. for the server endpoint:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy" ...&gt;
&lt;/wsp:Policy&gt;

&lt;jaxws:endpoint ...&gt;
    &lt;jaxws:features&gt;
        &lt;p:policies&gt;
            &lt;wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/&gt;
        &lt;/p:policies&gt;
    &lt;/jaxws:features&gt;
&lt;/jaxws:endpoint&gt;
</pre>
</div></div>

<p>As of CXF 3.0.0 both the older WS-ReliableMessagingPolicy 1.0 (submission version)
and the official WS-ReliableMessagingPolicy 1.2 are supported. WS-ReliableMessagingPolicy
1.2 must be used in the policy if you want WS-ReliableMessaging 1.2 support at runtime.</p>

<h2><a name="WSRMConfiguration-UsingtheReliableMessagingFeature"></a>Using
the Reliable Messaging Feature</h2>

<p>If you don't want to involve the WS-Policy Framework, or want to configure additional
parameters such as the sequence termination policy or the persistent store, you can use the
reliableMessaging feature. It is defined in namespace <a href="http://cxf.apache.org/ws/rm/manager"
class="external-link" rel="nofollow">http://cxf.apache.org/ws/rm/manager</a> and
supports 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'> RMAssertion </td>
<td class='confluenceTd'> An element of type RMAssertion. </td>
</tr>
<tr>
<td class='confluenceTd'> deliveryAssurance </td>
<td class='confluenceTd'> An element of type DeliveryAssuranceType that describes the
delivery assurance that should apply (AtMostOnce, AtLeastOnce, InOrder).</td>
</tr>
<tr>
<td class='confluenceTd'> sourcePolicy </td>
<td class='confluenceTd'> An element of type SourcePolicyType that allows you to configure
details of the RM source, such as whether an offer should always be included in a CreateSequence
request, or the sequence termination policy. </td>
</tr>
<tr>
<td class='confluenceTd'> destinationPolicy</td>
<td class='confluenceTd'> An element of type DestinationPolicyType that allows you to
configure details of the RM destination, such as whether inbound offers should be accepted.</td>
</tr>
<tr>
<td class='confluenceTd'> store </td>
<td class='confluenceTd'> The store to use (default: null). This must be an element
of type jdbcStore (in the same namespace), or a bean or a reference to a bean that implements
the RMStore interface. </td>
</tr>
</tbody></table>
</div>


<p>For details about the element types used in this namespace please refer to the schemas
for the <a href="http://cxf.apache.org/ws/rm/manager" class="external-link" rel="nofollow">http://cxf.apache.org/ws/rm/manager</a>
namespace (<a href="http://cxf.apache.org/schemas/wsrm-manager.xsd" class="external-link"
rel="nofollow">http://cxf.apache.org/schemas/wsrm-manager.xsd</a> and <a href="http://cxf.apache.org/schemas/wsrm-manager-types.xsd"
class="external-link" rel="nofollow">http://cxf.apache.org/schemas/wsrm-manager-types.xsd</a>).
The jbdcStore element type is described below.</p>

<p>Example (feature applied at bus level):</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;cxf:bus&gt;
    &lt;cxf:features&gt;
        &lt;wsa:addressing/&gt;
        &lt;wsrm-mgr:reliableMessaging&gt;
            &lt;wsrm-policy:RMAssertion&gt;
                &lt;wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/&gt;
          
                &lt;wsrm-policy:AcknowledgementInterval Milliseconds="2000"/&gt; 
        
            &lt;/wsrm-policy:RMAssertion&gt; 
            &lt;wsrm-mgr:sourcePolicy&gt;
                &lt;wsrm-mgr:sequenceTerminationPolicy maxLength="5"/&gt;        
           
            &lt;/wsrm-mgr:sourcePolicy&gt;     
            &lt;wsrm-mgr:destinationPolicy acceptOffers="false"&gt;            
            &lt;wsrm:store&gt;
               &lt;ref bean="myStore"/&gt;
            &lt;/wsrm:store&gt;
        &lt;/wsrm-mgr:reliableMessaging&gt;
    &lt;/cxf:features&gt;
&lt;/cxf:bus&gt;
</pre>
</div></div>

<h2><a name="WSRMConfiguration-ConfiguringtheReliableMessagingStore"></a>Configuring
the Reliable Messaging Store</h2>

<p>To enable persistence, you must specify the object implementing the persistent store
for RM. You can develop your own, or use the JDBC based store that comes with CXF (class org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore).
You can configure the latter using a custom jdbcStore bean (namespace <a href="http://cxf.apache.org/ws/rm/manager"
class="external-link" rel="nofollow">http://cxf.apache.org/ws/rm/manager</a>). It
supports the attributes:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Attribute Name </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Default </th>
</tr>
<tr>
<td class='confluenceTd'>driverClassName </td>
<td class='confluenceTd'> String </td>
<td class='confluenceTd'> org.apache.derby.jdbc.EmbeddedDriver </td>
</tr>
<tr>
<td class='confluenceTd'> userName </td>
<td class='confluenceTd'> String </td>
<td class='confluenceTd'> null </td>
</tr>
<tr>
<td class='confluenceTd'> passWord </td>
<td class='confluenceTd'> String </td>
<td class='confluenceTd'> null </td>
</tr>
<tr>
<td class='confluenceTd'> url </td>
<td class='confluenceTd'> String </td>
<td class='confluenceTd'> jdbc:derby:rmdb;create=true </td>
</tr>
</tbody></table>
</div>


<p>Example:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;wsrm-mgr:jdbcStore id="myStore"
    driverClassName="org.apache.derby.jdbc.ClientDriver"/&gt;
    url="jdbc:derby://localhost:1527/rmdb;create=true"/&gt;
    password="password"/&gt;
</pre>
</div></div>

<h2><a name="WSRMConfiguration-AddingtheReliableMessagingInterceptorsManually"></a>Adding
the Reliable Messaging Interceptors Manually</h2>

<p>To ensure that the Reliable Messaging interceptors are added to the appropriate interceptor
chains, e.g. for all client and server endpoints:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;bean id="rmLogicalOut" class="org.apache.cxf.ws.rm.RMOutInterceptor"&gt;
    &lt;property name="bus" ref="cxf"/&gt;
&lt;/bean&gt;
&lt;bean id="rmLogicalIn" class="org.apache.cxf.ws.rm.RMInInterceptor"&gt;
    &lt;property name="bus" ref="cxf"/&gt;
&lt;/bean&gt;
&lt;bean id="rmCodec" class="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/&gt;

&lt;cxf:bus ...&gt;
    &lt;cxf:inInterceptors&gt;
        &lt;ref bean="rmLogicalIn"/&gt;
        &lt;ref bean="rmCodec"/&gt;
    &lt;/cxf:inInterceptors&gt;
    &lt;cxf:inFaultInterceptors&gt;
        &lt;ref bean="rmLogicalIn"/&gt;
        &lt;ref bean="rmCodec"/&gt;
    &lt;/cxf:inFaultInterceptors&gt;
    &lt;cxf:outInterceptors&gt;
        &lt;ref bean="rmLogicalOut"/&gt;
        &lt;ref bean="rmCodec"/&gt;
    &lt;/cxf:outInterceptors&gt;
    &lt;cxf:outFaultInterceptors&gt;
        &lt;ref bean="rmLogicalOut"/&gt;
        &lt;ref bean="rmCodec"/&gt;
    &lt;cxf:outFaultInterceptors&gt;
&lt;/cxf:bus&gt;
</pre>
</div></div>

<p>The RetransmissionIntercepor will be added on the fly by the RMOutInterceptor so
need not appear in your configuration file.</p>

<h2><a name="WSRMConfiguration-ConfiguringtheReliableMessagingManagerManually"></a>Configuring
the Reliable Messaging Manager Manually</h2>

<p>To configure properties of the RM Manager, you can use the rmManager element from
the <a href="http://cxf.apache.org/ws/rm/manager" class="external-link" rel="nofollow">http://cxf.apache.org/ws/rm/manager</a>
namespace. It supports the same child elements as the reliableMessaging feature element above.
For example, without using features, you can determine that seuences should have a maximum
length of 5 as follows:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;wsrm-mgr:rmManager xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"&gt;
    &lt;wsrm-mgr:sourcePolicy&gt;
        &lt;wsrm-mgr:sequenceTerminationPolicy maxLength="5"/&gt;                
   
    &lt;/wsrm-mgr:sourcePolicy&gt;
&lt;/wsrm-mgr:rmManager&gt;
</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CXF20DOC">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/WSRMConfiguration">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=63092&revisedVersion=9&originalVersion=8">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/WSRMConfiguration?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message