Announcement Announcement Module
Collapse
No announcement yet.
Transforming spring-ws implementation to spring-integration-ws implementation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transforming spring-ws implementation to spring-integration-ws implementation

    Hi,

    I have an implementation of web service (server side) using spring-ws. I would like to change my code to use spring-integration-ws (ws:inbound-gateway and channels). I have tried examples but still not sure if it is possible to transform my implementation. In short my I am using @Endpoint, @PayloadRoot, PayloadRootAnnotationMethodEndpointMapping and JMS (as transport). Please find below my implementation:

    The endpoint class (MyEndpoint.java):

    Code:
    @Endpoint
    public class MyEndpoint {
    	@PayloadRoot(localPart="getUserRequest", namespace="http://play.zahid.springint/Jibx")
    	public GetUserResponse getUserResponse(GetUserRequest request){
    		log.info("Start getUserResponse " + request);
    		GetUserResponse response = new GetUserResponse();
    		
    		User user = new User();
    		user.setFirstName(request.getFirstName());
    		user.setLastName(request.getFirstName() + " Last");
    		response.setUser(user);
    		
    		log.info("End getUserResponse " + response);
    		return response;
    	}
    	
    	@PayloadRoot(localPart="sayHiUserRequest", namespace="http://play.zahid.springint/Jibx")
    	public SayHiResponse sayHiUserResponse(SayHiUserRequest request){
    		log.info("Start sayHiUserResponse " + request);
    		SayHiUserResponse response = new SayHiUserResponse();
    		
    		response.setResponse("Hi " + request.getFirstName() + " " + request.getLastName());
    		
    		log.info("End sayHiUserResponse " + response);
    		return response;
    	}	
    }
    The spring xml file (applicationContext.xml):

    Code:
    	<bean id="listenerContainer"
    		class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    		<property name="connectionFactory" ref="mqCachedConnectionFactory" />
    		<property name="destination" ref="defaultDestination" />
    		<property name="messageListener">
    			<bean class="org.springframework.ws.transport.jms.WebServiceMessageListener">
    				<property name="messageFactory" ref="messageFactory"/>
    				<property name="messageReceiver" ref="messageReceiver" />
    			</bean>
    		</property>
    		<property name="concurrentConsumers" value="1" />
    		<property name="acceptMessagesWhileStopping" value="false" />
    		<property name="recoveryInterval" value="10000" />
    		<property name="cacheLevelName" value="CACHE_CONSUMER" />
    	</bean>
    	
    	<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" />	
    	
     	<bean id="messageReceiver" class="org.springframework.ws.soap.server.SoapMessageDispatcher">
     		<property name="endpointAdapters">
     			<list>
    				<bean id="endpointAdapter" class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
    					<constructor-arg ref="marshaller" />
    				</bean>
     			</list>
     		</property> 		
     	</bean>
    
     	<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping" />
    For simplicity purpose I have removed the unnecessary codes and xml configuration.

    Is there anyway to keep my endpoint class (MyEndpoint.java) as it is and use spring-integration-ws support (ws:inbound-gateway and channel)?

    Let me know if you need any more information.

    Thanks
Working...
X