blob: fa05c3e5855dde4f6215060a5b7cd5604ed6bf7b [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<link type="text/css" rel="stylesheet" href="/resources/site.css">
<script src='/resources/space.js'></script>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="keywords" content="business integration, EAI, SOA, Service Oriented Architecture, web services, SOAP, JBI, JMS, WSDL, XML, EDI, Electronic Data Interchange, standards support, integration standards, application integration, middleware, software, solutions, services, CXF, open source">
<meta name="description" content="Apache CXF, Services Framework - WSRMConfiguration">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shCoreCXF.css">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
</script>
<title>
Apache CXF -- WSRMConfiguration
</title>
</head>
<body onload="init()">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td id="cell-0-0" colspan="2">&nbsp;</td>
<td id="cell-0-1">&nbsp;</td>
<td id="cell-0-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-1-0">&nbsp;</td>
<td id="cell-1-1">&nbsp;</td>
<td id="cell-1-2">
<!-- Banner -->
<div class="banner" id="banner"><div><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="left" colspan="1" nowrap>
<a shape="rect" href="http://cxf.apache.org/" title="Apache CXF"><span style="font-weight: bold; font-size: 170%; color: white">Apache CXF</span></a>
</td><td align="right" colspan="1" nowrap>
<a shape="rect" href="http://www.apache.org/" title="The Apache Sofware Foundation"><img border="0" alt="ASF Logo" src="http://cxf.apache.org/images/asf-logo.png"></a>
</td></tr></table></div></div>
<!-- Banner -->
<div id="top-menu">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td>
<div align="left">
<!-- Breadcrumbs -->
<a href="index.html">Index</a>&nbsp;&gt;&nbsp;<a href="configuration.html">Configuration</a>&nbsp;&gt;&nbsp;<a href="wsrmconfiguration.html">WSRMConfiguration</a>
<!-- Breadcrumbs -->
</div>
</td>
<td>
<div align="right">
<!-- Quicklinks -->
<div id="quicklinks"><p><a shape="rect" href="http://cxf.apache.org/download.html">Download</a> | <a shape="rect" href="http://cxf.apache.org/docs/index.html">Documentation</a></p></div>
<!-- Quicklinks -->
</div>
</td>
</tr>
</table>
</div>
</td>
<td id="cell-1-3">&nbsp;</td>
<td id="cell-1-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-2-0" colspan="2">&nbsp;</td>
<td id="cell-2-1">
<table>
<tr valign="top">
<td height="100%">
<div id="wrapper-menu-page-right">
<div id="wrapper-menu-page-top">
<div id="wrapper-menu-page-bottom">
<div id="menu-page">
<!-- NavigationBar -->
<div id="navigation"><ul class="alternate"><li><a shape="rect" href="overview.html">Overview</a></li><li><a shape="rect" href="how-tos.html">How-Tos</a></li><li><a shape="rect" href="frontends.html">Frontends</a></li><li><a shape="rect" href="databindings.html">DataBindings</a></li><li><a shape="rect" href="transports.html">Transports</a></li><li><a shape="rect" href="configuration.html">Configuration</a></li><li><a shape="rect" href="debugging-and-logging.html">Debugging and Logging</a></li><li><a shape="rect" href="tools.html">Tools</a></li><li><a shape="rect" href="restful-services.html">RESTful Services</a></li><li><a shape="rect" href="wsdl-bindings.html">WSDL Bindings</a></li><li><a shape="rect" href="service-routing.html">Service Routing</a></li><li><a shape="rect" href="dynamic-languages.html">Dynamic Languages</a></li><li><a shape="rect" href="ws-support.html">WS-* Support</a></li><li><a shape="rect" href="advanced-integration.html">Advanced Integration</a></li><li><a shape="rect" href="deployment.html">Deployment</a></li><li><a shape="rect" href="schemas-and-namespaces.html">Use of Schemas and Namespaces</a></li></ul><hr><ul class="alternate"><li><p>Search</p></li></ul><form enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box" action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="002890367768291051730:o99qiwa09y4">
<input type="hidden" name="ie" value="UTF-8">
<input type="text" name="q" size="21">
<input type="submit" name="sa" value="Search">
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script><hr><ul class="alternate"><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest/">API 3.2.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest-3.1.x/">API 3.1.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF Website</a></li></ul><p>&#160;</p><p><a shape="rect" class="external-link" href="http://www.apache.org/events/current-event.html"><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://www.apache.org/events/current-event-125x125.png" data-image-src="http://www.apache.org/events/current-event-125x125.png"></span></a></p></div>
<!-- NavigationBar -->
</div>
</div>
</div>
</div>
</td>
<td height="100%">
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><h1 id="WSRMConfiguration-UsingWS-ReliableMessaging">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 id="WSRMConfiguration-UsingtheRMAssertionandtheCXFWS-PolicyFramework">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 pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&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 pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&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 pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&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 id="WSRMConfiguration-UsingtheReliableMessagingFeature">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 shape="rect" href="http://cxf.apache.org/ws/rm/manager">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 colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>RMAssertion</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>An element of type RMAssertion.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>deliveryAssurance</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>An element of type DeliveryAssuranceType that describes the delivery assurance that should apply (AtMostOnce, AtLeastOnce, InOrder).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>sourcePolicy</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>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.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>destinationPolicy</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>An element of type DestinationPolicyType that allows you to configure details of the RM destination, such as whether inbound offers should be accepted.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>store</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>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.</p></td></tr></tbody></table></div><p>For details about the element types used in this namespace please refer to the schemas for the <a shape="rect" href="http://cxf.apache.org/ws/rm/manager">http://cxf.apache.org/ws/rm/manager</a> namespace (<a shape="rect" href="http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd">http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd</a> and <a shape="rect" href="http://cxf.apache.org/schemas/configuration/wsrm-manager-types.xsd">http://cxf.apache.org/schemas/configuration/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 pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&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 id="WSRMConfiguration-ConfiguringtheReliableMessagingStore">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 shape="rect" href="http://cxf.apache.org/ws/rm/manager">http://cxf.apache.org/ws/rm/manager</a>) inside the wsrm-mgr:reliableMessaging element. The jdbcStore bean supports the attributes:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Attribute Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>dataSource</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>null</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>driverClassName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>org.apache.derby.jdbc.EmbeddedDriver</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>initialReconnectDelay</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>long</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>0</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>keepConnection</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>maxReconnectAttempts</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>0</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>passWord</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>null</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>tableExistsCode</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>0</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>tableExistsState</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>null</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>schemaName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>null</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>userName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>null</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>url</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>jdbc:derby:rmdb;create=true</p></td></tr></tbody></table></div><p>Example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;wsrm-mgr:jdbcStore xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager" id="myStore"
driverClassName="org.apache.derby.jdbc.ClientDriver"
url="jdbc:derby://localhost:1527/rmdb;create=true"
password="password"/&gt;
</pre>
</div></div><p>See the jdbcStore element definition in the <a shape="rect" href="http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd">RM Manager schema</a> for more details of the attribute usages.</p><h2 id="WSRMConfiguration-AddingtheReliableMessagingInterceptorsManually">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 pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&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 id="WSRMConfiguration-ConfiguringtheReliableMessagingManagerManually">Configuring the Reliable Messaging Manager Manually</h2><p>To configure properties of the RM Manager, you can use the rmManager element from the <a shape="rect" href="http://cxf.apache.org/ws/rm/manager">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 pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&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>
<!-- Content -->
</td>
</tr>
</table>
</td>
<td id="cell-2-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-3-0">&nbsp;</td>
<td id="cell-3-1">&nbsp;</td>
<td id="cell-3-2">
<div id="footer">
<!-- Footer -->
<div id="site-footer">
<a href="http://cxf.apache.org/privacy-policy.html">Privacy Policy</a> -
(<a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=63092">edit page</a>)
(<a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=63092&amp;showComments=true&amp;showCommentArea=true#addcomment">add comment</a>)<br>
Apache CXF, CXF, Apache, the Apache feather logo are trademarks of The Apache Software Foundation.<br>
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
</div>
<!-- Footer -->
</div>
</td>
<td id="cell-3-3">&nbsp;</td>
<td id="cell-3-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-4-0" colspan="2">&nbsp;</td>
<td id="cell-4-1">&nbsp;</td>
<td id="cell-4-2" colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-4458903-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>