Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Clarify requirement for JNDI params when using jms:queue.

...

Code Block
java
java
      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"
            + "&jndiConnectionFactoryName=ConnectionFactory&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);
    }

Even if you want to use the 'queue' or 'topic' variants and avoid dealing with JNDI directly, you still have to specify the two factory parameters in the address:

Code Block

svrFactory.setAddress("jms:queue:test.cxf.jmstransport.queue?timeToLive=1000"
                              + "&jndiConnectionFactoryName=ConnectionFactory"
                              + "&jndiInitialContextFactory"
                              + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory");

Differences between the SOAP over JMS and the CXF old JMS transport implementation

...