blob: 27b2d1f3780a6348576cca9025c8f27507545100 [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 - SOAP over JMS 1.0 support">
<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/shBrushBash.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script src='/resources/highlighter/scripts/shBrushPlain.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
</script>
<title>
Apache CXF -- SOAP over JMS 1.0 support
</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="transports.html">Transports</a>&nbsp;&gt;&nbsp;<a href="jms-transport.html">JMS Transport</a>&nbsp;&gt;&nbsp;<a href="soap-over-jms-10-support.html">SOAP over JMS 1.0 support</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"><p>The <a shape="rect" href="jms-transport.html">JMS Transport</a> offers an alternative messaging mechanism to SOAP over HTTP. SOAP over JMS offers more reliable and scalable messaging support than SOAP over HTTP. The <a shape="rect" class="external-link" href="http://www.w3.org/TR/soapjms/" rel="nofollow">SOAP over JMS specification</a> is aimed at a set of standards for the transport of SOAP messages over JMS. Its main purpose is to ensure interoperability between the implementations of different Web services vendors. CXF supports and is compliant with this specification.</p><h2 id="SOAPoverJMS1.0support-SOAPoverJMSNamespace">SOAP over JMS Namespace</h2><h3 id="SOAPoverJMS1.0support-JMSURI">JMS URI</h3><p>JMS endpoints need to know the address information for establishing connections to the proper destination. SOAP over JMS implements the <a shape="rect" class="external-link" href="http://tools.ietf.org/id/draft-merrick-jms-uri-06.txt" rel="nofollow">URI Scheme for Java Message Service 1.0</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JMS URI Scheme</b></div><div class="codeContent panelContent pdl">
<pre class="brush: text; gutter: false; theme: Default">jms:&lt;variant&gt;:&lt;destination name&gt;?param1=value1&amp;param2=value2</pre>
</div></div><h3 id="SOAPoverJMS1.0support-Variants">Variants</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Prefix</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><strong>jndi</strong></td><td colspan="1" rowspan="1" class="confluenceTd">Destination name is a jndi queue name</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><strong>jndi-topic</strong></td><td colspan="1" rowspan="1" class="confluenceTd">Destination name is a jndi topic name</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><strong>queue</strong></td><td colspan="1" rowspan="1" class="confluenceTd">Destination is a queue name resolved using JMS</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><strong>topic</strong></td><td colspan="1" rowspan="1" class="confluenceTd">Destination is a topic name resolved using JMS</td></tr></tbody></table></div><p>Further parameters can be added as query parameters in the URI.</p><p>For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">jms:jndi:SomeJndiNameForDestination?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;jndiURL=tcp://localhost:61616&amp;priority=3
jms:queue:ExampleQueueName?timeToLive=1000
</pre>
</div></div><h3 id="SOAPoverJMS1.0support-JMSparameters">JMS parameters</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Query Parameter</p></th><th colspan="1" rowspan="1" class="confluenceTh">From <br clear="none">Version</th><th colspan="1" rowspan="1" class="confluenceTh"><p>DefaultValue</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">conduitIdSelectorPrefix</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">If set then this string will be the prefix for all correlation ids the conduit creates and also be used in the selector for listening to replies</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>deliveryMode</p></td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>PERSISTENT</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>NON_PERSISTENT messages will kept only in memory <br clear="none"> PERSISTENT messages will be saved to disk</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">durableSubscriptionClientId</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.1</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Optional Client identifier for the connection. The purpose is to associate a connection with a state maintained on behalf of the client by a provider. The only such state identified by the JMS API is that required to support durable subscriptions.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">durableSubscriptionName</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jndiConnectionFactoryName</p></td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>ConnectionFactory</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the JNDI name bound to the JMS connection factory to use when connecting to the JMS destination.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jndiInitialContextFactory</p></td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the fully qualified Java class name of the "InitialContextFactory" implementation class to use.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">jndiTransactionManagerName</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Name of the JTA TransactionManager. Will be searched in spring, blueprint and jndi.<br clear="none"> If a transaction manager is found then JTA transactions will be enabled. See details below.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jndiURL</p></td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the JNDI provider URL</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">jndi-*</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Additional parameters for a JNDI provider</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">messageType</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">byte</td><td colspan="1" rowspan="1" class="confluenceTd">JMS message type used by CXF (byte, text or binary)</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">password</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Password for creating the connection. Using this in the URI is discouraged</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">priority</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">4</td><td colspan="1" rowspan="1" class="confluenceTd">Priority for the messages. See your JMS provider documentation for details. Values range from 0 to 9 where 0 is lowest priority</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>replyToName</p></td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the JNDI name bound to the JMS destinations where replies are sent</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">receiveTimeout</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">60000</td><td colspan="1" rowspan="1" class="confluenceTd">Timeout in milliseconds the client waits for a reply in case of request / repy exchanges</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">reconnectOnException</td><td colspan="1" rowspan="1" class="confluenceTd"><p>deprecated</p><p>in 3.0.0</p></td><td colspan="1" rowspan="1" class="confluenceTd">true</td><td colspan="1" rowspan="1" class="confluenceTd">Should the transport reconnect in case of exceptions. From version 3.0.0 on the transport will always reconnect in case of exceptions</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">sessionTransacted</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">false</td><td colspan="1" rowspan="1" class="confluenceTd">Set to true for resource local transactions. Do not set if you use JTA</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>timeToLive</p></td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>0</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Time (in ms) after which the message will be discarded by the jms provider</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">topicReplyToName</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Reply to messages on a topic with this name. Depending on the variant this is either&#160; a jndi or jms name.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">useConduitIdSelector</td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">true</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Each conduit is assigned with a UUID. If set to true this conduit id will be the prefix for all correlation ids. This allows several endpoints to</p><p>share a JMS queue or topic</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>username</p></td><td colspan="1" rowspan="1" class="confluenceTd">3.0.0</td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Username for creating the connection</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">concurrentConsumers</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">1</td><td colspan="1" rowspan="1" class="confluenceTd">Number of consumers listening queue concurrently</td></tr></tbody></table></div><p>Some of these attributes are specified in the <a shape="rect" class="external-link" href="http://tools.ietf.org/id/draft-merrick-jms-uri-06.txt" rel="nofollow">JMS URI specification</a>.</p><h2 id="SOAPoverJMS1.0support-WSDLExtension">WSDL Extension</h2><p>The WSDL extensions for defining a JMS endpoint use a special namespace. In order to use the JMS WSDL extensions you will need to add the namespace definition shown below to the definitions element of your contract.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">xmlns:soapjms="http://www.w3.org/2010/soapjms/"
</pre>
</div></div><p>Various JMS properties may be set in three places in the WSDL &#8212; the binding, the service, and the port. Values specified at the service will propagate to all ports. Values specified at the binding will propagate to all ports using that binding. <br clear="none"> For example, if the <strong>jndiInitialContextFactory</strong> is indicated for a service, it will be used for all of the port elements it contains.</p><p>JMS Properties. For details refer to the URI query parameters with the same name:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>deliveryMode</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jndiConnectionFactoryName</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jndiInitialContextFactory</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jndiURL</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>replyToName</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>priority</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>timeToLive</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jndiContextParameter</p></td></tr></tbody></table></div><p>Here is an example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Ways to define a Service with JMS transport</b></div><div class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default">&lt;wsdl11:binding name="exampleBinding"&gt;
&lt;soapjms:jndiContextParameter name="name" value="value" /&gt;
&lt;soapjms:jndiConnectionFactoryName&gt;ConnectionFactory&lt;/soapjms:jndiConnectionFactoryName&gt;
&lt;soapjms:jndiInitialContextFactory&gt;org.apache.activemq.jndi.ActiveMQInitialContextFactory&lt;/soapjms:jndiInitialContextFactory&gt;
&lt;soapjms:jndiURL&gt;tcp://localhost:61616&lt;/soapjms:jndiURL&gt;
&lt;soapjms:deliveryMode&gt;PERSISTENT&lt;/soapjms:deliveryMode&gt;
&lt;soapjms:priority&gt;5&lt;/soapjms:priority&gt;
&lt;soapjms:timeToLive&gt;200&lt;/soapjms:timeToLive&gt;
&lt;/wsdl11:binding&gt;
&lt;wsdl11:service name="exampleService"&gt;
&lt;soapjms:jndiInitialContextFactory&gt;com.example.jndi.InitialContextFactory&lt;/soapjms:jndiInitialContextFactory&gt;
&lt;soapjms:timeTolive&gt;100&lt;/soapjms:timeToLive&gt;
&lt;wsdl11:port name="quickPort" binding="tns:exampleBinding"&gt;
&lt;soapjms:timeToLive&gt;10&lt;/soapjms:timeToLive&gt;
&lt;/wsdl11:port&gt;
&lt;wsdl11:port name="slowPort" binding="tns:exampleBinding"&gt;
...
&lt;/wsdl11:port&gt;
&lt;/wsdl11:service&gt;
</pre>
</div></div><p>If a property is specified at multiple levels, the setting at the most granular level takes precedence (port first, then service, then binding). In the above example, notice the timeToLive property &#8212; for the quickPort port, the value will be 10ms (specified at the port level). For the slowPort port, the value will be 100ms (specified at the service level). In this example, the setting in the binding will always be overridden.</p><h2 id="SOAPoverJMS1.0support-WSDLUsage">WSDL Usage</h2><p>For this example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Greeter Service with JMS transport</b></div><div class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default">&lt;wsdl:definitions name="JMSGreeterService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://cxf.apache.org/jms_greeter" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:x1="http://cxf.apache.org/jms_greeter/types"
xmlns:soapjms="http://www.w3.org/2010/soapjms/" name="JMSGreeterService"
targetNamespace="http://cxf.apache.org/jms_greeter"&gt;
...
&lt;wsdl:binding name="JMSGreeterPortBinding" type="tns:JMSGreeterPortType"&gt;
&lt;soap:binding style="document" transport="http://www.w3.org/2010/soapjms/" /&gt;
&lt;soapjms:jndiContextParameter name="name" value="value" /&gt;
&lt;soapjms:jndiConnectionFactoryName&gt;ConnectionFactory&lt;/soapjms:jndiConnectionFactoryName&gt;
&lt;soapjms:jndiInitialContextFactory&gt;org.apache.activemq.jndi.ActiveMQInitialContextFactory&lt;/soapjms:jndiInitialContextFactory&gt;
&lt;soapjms:jndiURL&gt;tcp://localhost:61616&lt;/soapjms:jndiURL&gt;
&lt;soapjms:deliveryMode&gt;PERSISTENT&lt;/soapjms:deliveryMode&gt;
&lt;soapjms:priority&gt;5&lt;/soapjms:priority&gt;
&lt;soapjms:timeToLive&gt;1000&lt;/soapjms:timeToLive&gt;
&lt;wsdl:operation name="greetMe"&gt;
&lt;soap:operation soapAction="test" style="document" /&gt;
&lt;wsdl:input name="greetMeRequest"&gt;
&lt;soap:body use="literal" /&gt;
&lt;/wsdl:input&gt;
&lt;wsdl:output name="greetMeResponse"&gt;
&lt;soap:body use="literal" /&gt;
&lt;/wsdl:output&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:binding&gt;
&lt;wsdl:service name="JMSGreeterService"&gt;
&lt;soapjms:jndiConnectionFactoryName&gt;ConnectionFactory&lt;/soapjms:jndiConnectionFactoryName&gt;
&lt;soapjms:jndiInitialContextFactory&gt;org.apache.activemq.jndi.ActiveMQInitialContextFactory&lt;/soapjms:jndiInitialContextFactory&gt;
&lt;wsdl:port binding="tns:JMSGreeterPortBinding" name="GreeterPort"&gt;
&lt;soap:address location="jms:jndi:dynamicQueues/test.cxf.jmstransport.queue" /&gt;
&lt;/wsdl:port&gt;
&lt;/wsdl:service&gt;
&lt;/wsdl:definitions&gt;
</pre>
</div></div><ul><li>The transport URI (<a shape="rect" class="external-link" href="http://www.w3.org/2010/soapjms/" rel="nofollow">http://www.w3.org/2010/soapjms/</a>) is defined in the &lt;soap:binding&gt;.</li><li>The jms: URI is defined in the &lt;soap:address&gt;</li><li>The extension properties are in the &lt;soap:binding&gt;</li></ul><h2 id="SOAPoverJMS1.0support-Defineserviceendpointorproxyinspringorblueprint">Define service endpoint or proxy in spring or blueprint</h2><p>The JAXWS endpoint or proxy can be defined like in the SOAP/HTTP case. Just use a jms: uri like described above.</p><p>In CXF 3 it is possible to omit the jndi settings. Just specify an endpoint like this:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Endpoint in spring</b></div><div class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default">&lt;bean id="ConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"&gt;
&lt;property name="brokerURL" value="tcp://localhost:61616"/&gt;
&lt;/bean&gt;
&lt;jaxws:endpoint id="CustomerService"
address="jms:queue:test.cxf.jmstransport.queue?timeToLive=1000"
implementor="com.example.customerservice.impl.CustomerServiceImpl"&gt;
&lt;/jaxws:endpoint&gt;</pre>
</div></div><p>or a Client like this:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Proxy in spring</b></div><div class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default">&lt;bean id="ConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"&gt;
&lt;property name="brokerURL" value="tcp://localhost:61616"/&gt;
&lt;/bean&gt;
&lt;jaxws:client id="CustomerService"
address="jms:queue:test.cxf.jmstransport.queue?timeToLive=1000"
serviceClass="com.example.customerservice.CustomerService"&gt;
&lt;/jaxws:client&gt;</pre>
</div></div><p>The connection factory will be looked up as a bean in the context. By default the name "ConnectionFactory" is assumed but it can be configured using the jndiConnectionFactoryName uri parameter.</p><p>Alternatively the connection factory can be set using the ConnectionFactoryFeature.</p><h2 id="SOAPoverJMS1.0support-PublishingaservicewiththeJAVAAPI">Publishing a service with the JAVA API</h2><p>Developers who don't wish to modify the WSDL file can also publish the endpoint information using Java code. For CXF's SOAP over JMS implementation you can write the following:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"> // You just need to set the address with JMS URI
String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue3"
+ "?jndiInitialContextFactory"
+ "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ "&amp;jndiConnectionFactoryName=ConnectionFactory&amp;jndiURL=tcp://localhost:61500";
Hello implementor = new HelloImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(Hello.class);
svrFactory.setAddress(address);
// And specify the transport ID with SOAP over JMS specification
svrFactory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID);
svrFactory.setServiceBean(implementor);
svrFactory.create();
// Alternatively using JAXWS Endpoint.create and avoiding JNDI
ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61500");
EndpointImpl ep = (EndpointImpl)Endpoint.create(impl);
ep.getFeatures().add(new ConnectionFactoryFeature(cf));
ep.publish("jms:queue:test.cxf.jmstransport.queue?timeToLive=1000");</pre>
</div></div><p>NOTE: For tests it can be useful to create an embedded broker 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"> public final void run() {
try {
broker = new BrokerService();
broker.setPersistent(false);
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.setTmpDataDirectory(new File("./target"));
broker.setUseJmx(false);
if (brokerName != null) {
broker.setBrokerName(brokerName);
}
broker.addConnector(brokerUrl1);
broker.start();
} catch (Exception e) {
e.printStackTrace();
}
}
</pre>
</div></div><h2 id="SOAPoverJMS1.0support-ConsumetheservicewiththeAPI">Consume the service with the API</h2><p>Sample code to consume a SOAP-over-JMS service is 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"> public void invoke() throws Exception {
// You just need to set the address with JMS URI
String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue3"
+ "?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ "&amp;jndiConnectionFactoryName=ConnectionFactory"
+ "&amp;jndiURL=tcp://localhost:61500";
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
// And specify the transport ID with SOAP over JMS specification
factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
factory.setServiceClass(Hello.class);
factory.setAddress(address);
Hello client = (Hello)factory.create();
String reply = client.sayHi(" HI");
System.out.println(reply);
}
// Alternatively using the JAXWS API with jms details defined in WSDL while avoiding JNDI
SOAPService2 service = new SOAPService2(wsdl, serviceName); // Using the generated service
ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61500");
ConnectionFactoryFeature cff = new ConnectionFactoryFeature(cf);
Greeter greeter = service.getPort(portName, Greeter.class, cff); // Connection Factory can be set as a feature in CXF &gt;= 3.0.0 </pre>
</div></div><p>If you specify queue or topic as variant and use cxf &gt;= 3.0.0 then the jndi settings are not necessary.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">svrFactory.setAddress("jms:queue:test.cxf.jmstransport.queue?timeToLive=1000");
// For CXF &gt;= 3.0.0
svrFactory.setFeatures(Collections.singletonList(new ConnectionFactoryFeature(cf)));</pre>
</div></div><p>In this case case the connection factory is supplied using a feature. For CXF 2.x the connection factory can only be supplied using jndi.</p><p>&#160;</p></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=2853910">edit page</a>)
(<a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=2853910&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>