Hello

I've developed a CXF service that uses JMS transport. My configuration
[1] is all in the applicationContext.xml rather than WSDL or in the
code as part of the @WebService.

Now, instead of targeting the JMS directly, I want to use a JNDI
resource defined in WebSphere.
I haven't been able to find any documentation on how to do this with
CXF (but I keep finding information on "<jms:conduit" and
"<jms:destination"
configurations which I believe have been superseded by the JMSConfigFeature).

I'm expecting that I will NOT need the tcp://... broker url, since
that's already configured in the JNDI resource itself.
I should only need:
- JNDI name (as configured in WebSphere)
- targetDestination (the JNDI name of the target queue)
- replyDestination (then JNDI name of the target queue)
- username (optional)
- password (optional).

But I'm confused about the "wrapped connection factory" and
org.apache.cxf.transport.jms.JNDIConfiguration pieces.

Where does the JNDI configuration go, and what parameters do I need?

<jaxws:endpoint
     xmlns:batch="urn://my.namespace.here" id="MyId"
     address="jms://" transportId="http://cxf.apache.org/transports/jms";
     serviceName="ns1:MyService"
     endpointName="ns1:MyPort"  
     implementor="com.some.path.MyImpl"
wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
     <jaxws:features>
          <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
                  <property name="jmsConfig" ref="jmsConfig" />
          </bean>
        </jaxws:features>
</jaxws:endpoint>

<bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">

     <!-- Do I need a wrapped connection factory to access a JNDI
resource ? -->
     <property name="connectionFactory" ref="wrappedConnectionFactory" />

     <!-- These should be the JNDI names of the queues ... -->
     <property name="targetDestination" value="myRequestQueue"/>
     <property name="replyDestination" value="myResponseQueue"/>

     <!-- I'm guessing I'll need this ... -->
     <property name="jndiConfig" ref="jndiConfig" />
</bean>

<!-- Maybe I don't need the wrapped connection at all for a JNDI-JMS
config ? -->
<bean id="wrappedConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
     <property name="targetConnectionFactory">

        <!-- Shouldn't need this: the JNDI resource handles this. So maybe I
don't need this wrapped factory ? -->
        <!-- bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL" value="tcp://localhost:61616" />
        </bean -->
     </property>
</bean>

<!-- Is this where the JNDI name belongs? -->
<bean id="jndiConfig" class="org.apache.cxf.transport.jms.JNDIConfiguration">
     <property name="environment">
          <props>
               <prop
key="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</prop>

               <!-- does the name of the JNDI resource go here ?? -->

               <!-- Shouldn't need this: the JNDI resource handles this -->
               <!-- prop
key="java.naming.provider.url">tcp://localhost:61616</prop -->
          </props>
     </property>
</bean>



[2] Current applicationContext.xml, targeting the message queue directly (works)

<jaxws:endpoint
     xmlns:batch="urn://my.namespace.here" id="MyId"
     address="jms://" transportId="http://cxf.apache.org/transports/jms";
     serviceName="ns1:MyService"
     endpointName="ns1:MyPort"  
     implementor="com.some.path.MyImpl"
wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
     <jaxws:features>
          <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
                  <property name="jmsConfig" ref="jmsConfig" />
          </bean>
        </jaxws:features>
</jaxws:endpoint>
        
<bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
     <property name="connectionFactory" ref="wrappedConnectionFactory" />
     <property name="targetDestination" value="myRequestQueue"/>
     <property name="replyDestination" value="myResponseQueue"/>
     <!-- false means use queues, true means use topics  -->
     <property name="pubSubDomain" value="false"/>
</bean>
        
<bean id="wrappedConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
     <property name="targetConnectionFactory">
          <bean class="org.apache.activemq.ActiveMQConnectionFactory">
               <property name="brokerURL" value="tcp://localhost:61616" />
          </bean>
     </property>
</bean>

-Jeff

Reply via email to