The JMS Transport offers an alternative messaging mechanism to SOAP over HTTP. SOAP over JMS offers more reliable and scalable messaging support than SOAP over HTTP. The SOAP over JMS specification 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.
SOAP over JMS Namespace
WSDL Namespace
...
JMS
...
JMS Extension Namespace
Code Block |
---|
xmlns:soapjms="http://www.w3.org/2010/soapjms/"
|
...
URI
JMS endpoints need to know the address information for establishing connections to the proper destination. SOAP over JMS implements the URI Scheme for Java Message Service 1.0.
This URI scheme starts with "jms:jndi:" plus a JNDI name for a Destination. Since interaction with some resources may require JNDI contextual information or JMS header fields and properties to be specified as well, the "jndi" variant of the "jms" URI scheme includes support for supplying this additional JNDI information as query parameters.
Code Block | ||||
---|---|---|---|---|
| ||||
jms:<variant>:<destination name>?param1=value1¶m2=value2 |
Variants
Prefix | Description |
---|---|
jndi | Destination name is a jndi queue name |
jndi-topic | Destination name is a jndi topic name |
queue | Destination is a queue name resolved using JMS |
topic | Destination is a topic name resolved using JMS |
Further parameters can be added as query parameters in the URICXF supports three variants, "jndi", "queue", and "topic".
For example:
Code Block |
---|
jms:jndi:SomeJndiNameForDestination?jndiInitialContextFactory=comorg.apache.exampleactivemq.jndi.JndiFactoryActiveMQInitialContextFactory&jndiURL=tcp://localhost:61616&priority=3 jms:queue:ExampleQueueName?timeToLive=1000 |
Properties are as follows:
Query parameters
Query ParameterProperty | From Version | DefaultValue | Description | ||||
---|---|---|---|---|---|---|---|
conduitIdSelectorPrefix | 3.0.0 | 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 | |||||
deliveryMode | PERSISTENT | NON_PERSISTENT messages will kept only in memory | |||||
durableSubscriptionName | 3.0.0 | ||||||
jndiConnectionFactoryName | ConnectionFactory | Specifies the JNDI name bound to the JMS connection factory to use when connecting to the JMS destination. | |||||
jndiInitialContextFactory |
| Specifies the fully qualified Java class name of the "InitialContextFactory" implementation class to use. | |||||
jndiTransactionManagerName | 3.0.0 | Name of the JTA TransactionManager. Will be searched in spring, blueprint and jndi. | |||||
jndiURL |
| Specifies the JNDI provider URL | |||||
jndi-* | Additional parameters for a JNDI provider | ||||||
messageType | 3.0.0 | byte | JMS message type used by CXF (byte, text or binary) | ||||
password | 3.0.0 | Password for creating the connection. Using this in the URI is discouraged | |||||
priority | 3.0.0 | 4 | Priority for the messages. See your JMS provider documentation for details. Values range from 0 to 9 where 0 is lowest priority | ||||
replyToName |
| Specifies the JNDI name bound to the JMS destinations where replies are sent | |||||
receiveTimeout | 3.0. | priority | 4 | Priority for the messages. See your JMS provider documentation for details0 | 60000 | Timeout in milliseconds the client waits for a reply in case of request / repy exchanges | |
reconnectOnException | deprecated in 3.0.0 | true | Should the transport reconnect in case of exceptions. From version 3.0.0 on the transport will always reconnect in case of exceptions | ||||
sessionTransacted | 3.0.0 | false | Set to true for resource local transactions. Do not set if you use JTA | ||||
targetService | |||||||
timeToLive | 0 | Time (in ms) after which the message will be discarded by the jms providerAdditional JNDI Parameters | |||||
topicReplyToName | Additional parameters for a JNDI provider. A custom parameter name must start with the prefix "jndi-". | Reply to messages on a topic with this name. Depending on the variant this is either a jndi or jms name. | |||||
useConduitIdSelector | 3.0.0 | true | 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 share a JMS queue or topic | ||||
username | 3.0.0 |
| Username for creating the connection |
Some of these attributes are specified in For more details about these attributes, please check out the JMS URI specification.
WSDL Extension
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.
Code Block |
---|
xmlns:soapjms="http://www.w3.org/2010/soapjms/"
|
Various JMS properties may be set in three places in the WSDL — 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.
For example, if the jndiInitialContextFactory is indicated for a service, it will be used for all of the port elements it contains.
JMS Properties. For details refer to the URI query parameters with the same name:
Name | ||
---|---|---|
deliveryMode | ||
jndiConnectionFactoryName | ||
jndiInitialContextFactory | ||
jndiURL | ||
replyToName | ||
priority | ||
timeToLive | ||
jndiContextParameter | ||
Field | DefaultValue | Description |
deliveryMode | PERSISTENT | NON_PERSISTENT messages will only be kept in memory |
jndiConnectionFactoryName |
| Specifies the JNDI name bound to the JMS connection factory to use when connecting to the JMS destination. |
jndiInitialContextFactory |
| Specifies the fully qualified Java class name of the "InitialContextFactory" implementation class to use. |
jndiURL |
| Specifies the JNDI provider URL |
replyToName |
| Specifies the JNDI name bound to the JMS destinations where replies are sent. |
priority | 4 | Priority for the messages. See your JMS provider doc for details |
timeToLive | 0 | Time (in ms) after which the message will be discarded by the jms provider |
jndiContextParameter |
| Additional parameters for a JNDI provider. |
Here is an example:
Code Block | ||||
---|---|---|---|---|
| ||||
<wsdl11:binding name="exampleBinding"> <soapjms:jndiContextParameter name="name" value="value" /> <soapjms:jndiConnectionFactoryName>ConnectionFactory <jndiConnectionFactoryName>ConnectionFactory</soapjms:jndiConnectionFactoryName> <soapjms:jndiInitialContextFactory> orgjndiInitialContextFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory <ActiveMQInitialContextFactory</soapjms:jndiInitialContextFactory> <soapjms:jndiURL>tcp://localhost:61616 <61616</soapjms:jndiURL> <soapjms:deliveryMode>PERSISTENT</soapjms:deliveryMode> <soapjms:priority>5</soapjms:priority> <soapjms:timeToLive>200</soapjms:timeToLive> </wsdl11:binding> <wsdl11:service name="exampleService"> <soapjms:jndiInitialContextFactory> comjndiInitialContextFactory>com.example.jndi.InitialContextFactory <InitialContextFactory</soapjms:jndiInitialContextFactory> <soapjms:timeTolive>100</soapjms:timeToLive> ... <wsdl11:port name="quickPort" binding="tns:exampleBinding"> ... <soapjms:timeToLive>10</soapjms:timeToLive> </wsdl11:port> <wsdl11:port name="slowPort" binding="tns:exampleBinding"> ... </wsdl11:port> </wsdl11:service> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<wsdl:definitions name="JMSGreeterService" <wsdl:binding name="JMSGreeterPortBinding" type="tns:JMSGreeterPortType"> <soap:binding style="document" transport="http://www.w3.org/2010/soapjms/" /> <soapjms:jndiContextParameter name="name" value="value" /> <soapjms:jndiConnectionFactoryName>ConnectionFactory <jndiConnectionFactoryName>ConnectionFactory</soapjms:jndiConnectionFactoryName> <soapjms:jndiInitialContextFactory> orgjndiInitialContextFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory <ActiveMQInitialContextFactory</soapjms:jndiInitialContextFactory> <soapjms:jndiURL>tcp://localhost:61616 <61616</soapjms:jndiURL> <soapjms:deliveryMode>PERSISTENT</soapjms:deliveryMode> <soapjms:priority>5</soapjms:priority> <soapjms:timeToLive>1000</soapjms:timeToLive> <wsdl:operation name="greetMe"> <soap:operation soapAction="test" style="document" /> <wsdl:input name="greetMeRequest"> <soap:body use="literal" /> </wsdl:input> <wsdl:output name="greetMeResponse"> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="JMSGreeterService"> <soapjms:jndiConnectionFactoryName>ConnectionFactory <jndiConnectionFactoryName>ConnectionFactory</soapjms:jndiConnectionFactoryName> <soapjms:jndiInitialContextFactory> orgjndiInitialContextFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory <ActiveMQInitialContextFactory</soapjms:jndiInitialContextFactory> <wsdl:port binding="tns:JMSGreeterPortBinding" name="GreeterPort"> <soap:address location="jms:jndi:dynamicQueues/test.cxf.jmstransport.queue" /> </wsdl:port> </wsdl:service> </wsdl:definitions> |
...