Skip to end of metadata
Go to start of metadata

This guide gives you a quick rundown of how to configure XFire to use JMS as a transport. JMS is one of the easiest means to create a reliable SOAP connection. Additionally it is much faster then things such as WS-Reliability.

This example assumes that you already know how to:

  • Configure services via XFire's services.xml format
  • Build and deploy simple XFire applications
  • Use your JMS provider
  • A working knowledge of Spring

(Or check out this standalone example which uses Aegis binding and OpenJMS)

We're just going to show a simple synchronous Echo example running over JMS. The first thing you need to do is create your services.xml file (see below for more information re: Spring 2.0):

There is a lot in here, so lets recap this a little bit.

The <xfire> section contains a <transports> element. In <transports> we are creating our JMSTransport via the Spring bean syntax. XFire will then automatically register this transport for us into the TransportManager.

The <service> element contains our service definition. This is pretty standard, except you'll notice we're creating a new binding for JMS. <soap11Binding transport="urn:xfire:transport:jms"> tells XFire that we want to add a SOAP 1.1 binding for JMS. In the endpoints section we tell XFire exactly what that endpoint will be. The JMS urls take the form of jms://{QueueName}.

In the sections below we configure our JMS QueueConnectionFactory using ActiveMQ.

Spring 2.0 

For Spring 2.0, you must define the services.xml root element as follows:

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

 For the service definition to work correctly, you must define the service root element as follows:

<service xmlns="http://xfire.codehaus.org/config/1.0">

When registering the JMS transport, you must specify the xmlns on the <xfire> element, as follows:

  <xfire xmlns=" http://xfire.codehaus.org/config/1.0">
    <transports>
      <bean id="jmsTransport"
            class="org.codehaus.xfire.transport.jms.JMSTransport"
            xmlns="http://xbean.org/schemas/spring/1.0">
        <constructor-arg ref="xfire"/>
        <constructor-arg ref="jmsConnectionFactory"/>
      </bean>
    </transports>
  </xfire>

Thanks to Chris Mathrusse for getting to the bottom of this and providing this information back to the XFire community.

Once all of this is properly configured we will of course want to write a client:

Labels
  • None