You can specify the basic configuration of the JMS transport by inserting WSDL
extension elements into the contract, either at binding scope, service scope, or port
scope. The WSDL extensions enable you to specify the properties for bootstrapping a JNDI
InitialContext
, which can then be used to look up JMS destinations. You can
also set some properties that affect the behavior of the JMS transport layer.
the SOAP/JMS WSDL extensions are defined in the
http://www.w3.org/2010/soapjms/
namespace. To use them in
your WSDL contracts add the following setting to the
wsdl:definitions
element:
<wsdl:definitions ... xmlns:soapjms="http://www.w3.org/2010/soapjms/" ... >
Table 3.4 shows all of the WSDL extension elements you can use to configure the JMS transport.
Table 3.4. SOAP/JMS WSDL extension elements
Element | Default | Description |
---|---|---|
soapjms:jndiInitialContextFactory | Specifies the fully qualified Java class name of the JNDI provider.
Equivalent to setting the java.naming.factory.initial Java system
property. | |
soapjms:jndiURL | Specifies the URL that initializes the JNDI provider. Equivalent to setting
the java.naming.provider.url Java system property. | |
soapjms:jndiContextParameter | Enables you to specify an additional property for creating the JNDI
InitialContext . Use the name and value
attributes to specify the property. | |
soapjms:jndiConnectionFactoryName | Specifies the JNDI name of the JMS connection factory. | |
soapjms:deliveryMode | PERSISTENT | Specifies whether to use JMS PERSISTENT or
NON_PERSISTENT message semantics. In the case of
PERSISTENT delivery mode, the JMS broker stores messages in
persistent storage before acknowledging them; whereas NON_PERSISTENT
messages are kept in memory only. |
soapjms:replyToName |
Explicitly specifies the reply destination to appear in the
The value of this property has an interpretation that depends on the variant specified in the JMS URI, as follows:
| |
soapjms:priority | 4 | Specifies the JMS message priority, which ranges from 0 (lowest) to 9 (highest). |
soapjms:timeToLive | 0 | Time, in milliseconds, after which the message will be discarded by the JMS
provider. A value of 0 represents an infinite lifetime. |
The WSDL elements placement in the WSDL contract effect the scope of the
configuration changes on the endpoints defined in the contract. The SOAP/JMS WSDL elements
can be placed as children of either the wsdl:binding
element,
the wsdl:service
element, or the
wsdl:port
element. The parent of the SOAP/JMS elements
determine which of the following scopes the configuration is placed into.
- Binding scope
You can configure the JMS transport at the binding scope by placing extension elements inside the
wsdl:binding
element. Elements in this scope define the default configuration for all endpoints that use this binding. Any settings in the binding scope can be overridden at the service scope or the port scope.- Service scope
You can configure the JMS transport at the service scope by placing extension elements inside a
wsdl:service
element. Elements in this scope define the default configuration for all endpoints in this service. Any settings in the service scope can be overridden at the port scope.- Port scope
You can configure the JMS transport at the port scope by placing extension elements inside a
wsdl:port
element. Elements in the port scope define the configuration for this port. They override any defaults defined at the service scope or at the binding scope.
Example 3.7 shows a WSDL contract for a SOAP/JMS service. It configures the JNDI layer in the binding scope, the message delivery details in the service scope, and the reply destination in the port scope.
Example 3.7. WSDL contract with SOAP/JMS configuration
<wsd;definitions ...xmlns:soapjms="http://www.w3.org/2010/soapjms/" ... > ... <wsdl:binding name="JMSGreeterPortBinding" type="tns:JMSGreeterPortType"> ...
<soapjms:jndiInitialContextFactory> org.apache.activemq.jndi.ActiveMQInitialContextFactory </soapjms:jndiInitialContextFactory> <soapjms:jndiURL>tcp://localhost:61616</soapjms:jndiURL> <soapjms:jndiConnectionFactoryName> ConnectionFactory </soapjms:jndiConnectionFactoryName> ... </wsdl:binding> ... <wsdl:service name="JMSGreeterService"> ...
<soapjms:deliveryMode>NON_PERSISTENT</soapjms:deliveryMode> <soapjms:timeToLive>60000</soapjms:timeToLive> ... <wsdl:port binding="tns:JMSGreeterPortBinding" name="GreeterPort">
<soap:address location="jms:jndi:dynamicQueues/test.cxf.jmstransport.queue" />
<soapjms:replyToName> dynamicQueues/greeterReply.queue </soapjms:replyToName> ... </wsdl:port> ... </wsdl:service> ... </wsdl:definitions>
The WSDL in Example 3.7 does the following:
Declare the namespace for the SOAP/JMS extensions. | |
Configure the JNDI connections in the binding scope. | |
Configure the JMS delivery style to non-persistent and each message to live for one minute. | |
Specify the target destination. | |
Configure the JMS transport so that reply messages are delivered on the
|