LibraryToggle FramesPrintFeedback

The SOAP over JMS protocol is defined by the World Wide Web Consortium(W3C) as a way of providing a more reliable transport layer to the customary SOAP/HTTP protocol used by most services. The Fuse Services Framework implementation is fully compliant with the specification and should be compatible with any framework that is also compliant.

This transport uses JNDI to find the JMS destinations. When an operation is invoked, the request is packaged as a SOAP message and sent in the body of a JMS message to the specified destination.

Publishing and consuming SOAP/JMS services differ from SOAP/HTTP services in the following ways:

  • SOAP/JMS service addressed are specified using a special JMS URI

  • you must use the Fuse Services Framework specific factory objects to use SOAP/JMS endpoints

JMS endpoints use a JMS URI as defined in the URI Scheme for JMS 1.0. Example 17.1 shows the syntax for a JMS URI.


Table 17.1 describes the available variants for the JMS URI.


Table 17.2 shows the URI options.


The JAX-WS standard publish() method cannot be used to publish a SOAP/JMS service. Instead, you must use the Fuse Services Framework's JaxWsServerFactoryBean class as shown in Example 17.2.

Example 17.2. Publishing a SOAP/JMS service

1String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue3"
    + "?jndiInitialContextFactory"
    + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
    + "&jndiConnectionFactoryName=ConnectionFactory"
    + "&jndiURL=tcp://localhost:61500";
Hello implementor = new HelloImpl();
2JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(Hello.class);
3svrFactory.setAddress(address);
4svrFactory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
svrFactory.setServiceBean(implementor);
svrFactory.create();

The code in Example 17.2 does the following:

1

Creates the JMS URI representing t he endpoint's address.

2

Instantiates a JaxWsServerFactoryBean to publish the service.

3

Sets the address field of the factory bean with the JMS URI of the service.

4

Specifies that the service created by the factory will use the SOAP/JMS transport.

The standard JAX-WS APIs cannot be used to consume a SOAP/JMS service. Instead, you must use the Fuse Services Framework's JaxWsProxyFactoryBean class as shown in Example 17.3.

Example 17.3. Consuming a SOAP/JMS service

// Java
public void invoke() throws Exception {
1    String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue3"
        + "?jndiInitialContextFactory"
        + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
        + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61500";
2    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
3    factory.setAddress(address);
4    factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
    factory.setServiceClass(Hello.class);
    Hello client = (Hello)factory.create();
    String reply = client.sayHi(" HI");
    System.out.println(reply);
}

The code in Example 17.3 does the following:

1

Creates the JMS URI representing t he endpoint's address.

2

Instantiates a JaxWsProxyFactoryBean to create the proxy.

3

Sets the address field of the factory bean with the JMS URI of the service.

4

Specifies that the proxy created by the factory will use the SOAP/JMS transport.

Comments powered by Disqus
loading table of contents...