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:
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)
For example I am giving xml configuration for webservice client that I am trying right now. Can you please check what I am missing?
<bean id="jndiEnvironment" class="java.util.Properties">
<constructor-arg>
<map>
<entry key="java.naming.factory.initial" value="value" />
<entry key="java.naming.provider.url" value="value" />
<entry key="java.naming.security.principal" value="value" />
<entry key="java.naming.security.credentials" value="value" />
</map>
</constructor-arg>
</bean>
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="/my/jndi/name" />
<property name="jndiEnvironment" ref="jndiEnvironment" />
</bean>
<bean id="marshaller" class="org.springframework.oxm.jibx.JibxMarshaller">
<property name="targetClass" value="zahid.play.si.ws.jms.GetCountryDescriptionRequest" />
</bean>
<bean id="destinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiEnvironment" ref="jndiEnvironment" />
</bean>
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" />
<bean id="messageSender" class="org.springframework.ws.transport.jms.JmsMessageSender">
<property name="connectionFactory" ref="connectionFactory" />
<property name="destinationResolver" ref="destinationResolver" />
</bean>
<bean id="messageTemplate" class="org.springframework.integration.core.MessagingTemplate">
<property name="defaultChannel" ref="requestChannel" />
</bean>
<int:channel id="requestChannel" />
<ws:outbound-gateway id="wsClientGateway"
uri="jms:MY.TOPIC?messageType=TEXT_MESSAGE&deliveryMode=NON_PERSISTENT"
message-factory="messageFactory" marshaller="marshaller" unmarshaller="marshaller"
message-sender="messageSender"
request-channel="requestChannel" />
In the java code I am using: messagingTemplate.convertSendAndReceive(MessageBuilder.withPayload(request).build()) to send a request.
But I am getting this error:
[jms:MY.TOPIC?messageType=TEXT_MESSAGE&deliveryMode =NON_PERSISTENT] is not a valid HTTP URL