title: Using spring integration web service gateways with JMS
body: <p>I need to implement a webservice client (and after that a webservice server) using spring-integration. I have already worked with the samples given by spring-integration team. That implementation uses HTTP as a transport layer. The client is making a HTTP request and server is sending back HTTP response. Instead of using HTTP I would like to use JMS as a transport layer. In this case client sends a SOAP-Request to a Queue (the server is listening to this queue) and while sending it also creates a temporary Queue and set that in the RepyTo in the JMS message header. Server gets receives the request from the Queue process it and then send back a SOAP-Response using the ReplyTo queue. I know we can do it using spring-ws and spring-jms libraries. I would like to do it using spring-integration support for ws and jms:</p>
  
  <p>client sending request: java object -> Soap Message -> JMS message (payload is the SOAP xml) 
  server receiving request: JMS message (payload is the SOAP xml) -> Soap Message -> java object
  server sending back response: java object -> Soap Message -> JMS message (payload is the SOAP xml) </p>
  
  <p>For example I am giving xml configuration for webservice client that I am trying right now. Can you please check what I am missing?</p>
  
  <pre><code>&lt;bean id="jndiEnvironment" class="java.util.Properties"&gt;
      &lt;constructor-arg&gt;
          &lt;map&gt;
              &lt;entry key="java.naming.factory.initial" value="value" /&gt;
              &lt;entry key="java.naming.provider.url" value="value" /&gt;
              &lt;entry key="java.naming.security.principal" value="value" /&gt;
              &lt;entry key="java.naming.security.credentials" value="value" /&gt;  
          &lt;/map&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  
  &lt;bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"&gt;
      &lt;property name="jndiName" value="/my/jndi/name" /&gt;
      &lt;property name="jndiEnvironment" ref="jndiEnvironment" /&gt;
  &lt;/bean&gt; 
  
  &lt;bean id="marshaller" class="org.springframework.oxm.jibx.JibxMarshaller"&gt;
      &lt;property name="targetClass" value="zahid.play.si.ws.jms.GetCountryDescriptionRequest" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="destinationResolver"
      class="org.springframework.jms.support.destination.JndiDestinationResolver"&gt;
      &lt;property name="jndiEnvironment" ref="jndiEnvironment" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" /&gt;
  
  &lt;bean id="messageSender" class="org.springframework.ws.transport.jms.JmsMessageSender"&gt;
      &lt;property name="connectionFactory" ref="connectionFactory" /&gt;
      &lt;property name="destinationResolver" ref="destinationResolver" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="messageTemplate" class="org.springframework.integration.core.MessagingTemplate"&gt; 
      &lt;property name="defaultChannel" ref="requestChannel" /&gt; 
  &lt;/bean&gt; 
  
  &lt;int:channel id="requestChannel" /&gt;
  
  &lt;ws:outbound-gateway id="wsClientGateway"
      uri="jms:MY.TOPIC?messageType=TEXT_MESSAGE&amp;amp;deliveryMode=NON_PERSISTENT"             
      message-factory="messageFactory" marshaller="marshaller" unmarshaller="marshaller"  
      message-sender="messageSender"  
      request-channel="requestChannel" /&gt;
  </code></pre>
  
  <p>In the java code I am using: <code>messagingTemplate.convertSendAndReceive(MessageBuilder.withPayload(request).build())</code> to send a request. </p>
  
  <p>But I am getting this error: </p>
  
  <pre><code>[jms:MY.TOPIC?messageType=TEXT_MESSAGE&amp;deliveryMode =NON_PERSISTENT] is not a valid HTTP URL 
  </code></pre>