Using the JMS Binding Component

Using the jndi Approach

Use the jndi approach for either of the following scenarios:

Set the connection URL to jndi:// and specify the JNDI options.

When you use a wizard to create a JMS-based concrete WSDL document, you set the connection URL in the Request Connection Configuration step of the wizard. You then specify the JNDI options in the Advanced Configuration step of the wizard. For more information, see Creating JMS-Based Concrete WSDL Documents.

The following table describes the available JNDI options.

JNDI Option 

Description 

JMSJCA.UnifiedCF

The JNDI name of the connection factory. Use this option only in outbound scenarios. 

JMSJCA.TopicCF

The JNDI name of topic connection factory. You can use this option in inbound or outbound scenarios. 

JMSJCA.QueueCF

The JNDI name of queue connection factory. You can use this option in inbound or outbound scenarios. 

java.naming.factory.initial

The fully qualified class name of the factory class that will create the initial context. An initial context is the starting point for naming operations. For more information, see the Java API documentation for javax.naming.Context.INITIAL_CONTEXT_FACTORY.

java.naming.provider.url

The configuration information for the service provider to use. The value should contain a URL string. For more information, see the Java API documentation for javax.naming.Context.PROVIDER_URL.

java.naming.security.principal

The identity of the principal for authenticating the caller to the service. For more information, see the Java API documentation for javax.naming.Context.SECURITY_PRINCIPAL.

java.naming.security.credentials

The credentials of the principal for authenticating the caller to the service. For more information, see the Java API documentation for javax.naming.Context.SECURITY_CREDENTIALS.

The destinationType and transaction attributes in the WSDL document determine what type of connection factory is being looked up. For example, if the destinationType attribute is Queue and the transaction attribute is XATransaction, then the connection factory must be of type javax.jms.XAQueueConnectionFactory.

The following code shows an example of specifying the JNDI options. In this scenario, the connection factory is bound in the JMS server itself.


JMSJCA.UnifiedCF=connectionfactories/xaconnectionfactory
JMSJCA.TopicCF=connectionfactories/xatopicconnectionfactory
JMSJCA.QueueCF=connectionfactories/xaqueueconnectionfactory
java.naming.factory.initial=com.stc.jms.jndispi.InitialContextFactory
java.naming.provider.url=stcms://localhost:18007
java.naming.security.principal=Administrator
java.naming.security.credentials=STC

When you finish the wizard, the appropriate WSDL code is generated. The connection URL appears in the address element. The JNDI options appear in the jmsjcaOptions element. For example:


<port name="newWSDL_InPort" binding="tns:JMSInBinding">
  <jms:address connectionURL="jndi://">
    <jms:jmsjcaOptions>
      <![CDATA[JMSJCA.UnifiedCF=connectionfactories/xaconnectionfactory
      JMSJCA.TopicCF=connectionfactories/xatopicconnectionfactory
      JMSJCA.QueueCF=connectionfactories/xaqueueconnectionfactory
      java.naming.factory.initial=com.stc.jms.jndispi.InitialContextFactory
      java.naming.provider.url=stcms://localhost:18007
      java.naming.security.principal=Administrator
      java.naming.security.credentials=STC]]>
    </jms:jmsjcaOptions>
  </jms:address>
</port>

At runtime, the JMS Binding Component uses the JNDI options to obtain the connection factory.