Hi everybody , i'm new at spring integration and i'm having a problema that maybe it's easy for most of you ...
My sample app have a service that is exposed to both rest services and web services.
For the rest services part i configured a inboud gateway and then used json-to-object and it works porperly
then i commented that configuration and impelemented a ws-inbound-gateway that also works fine.
But i cannot use both becasue of the servlet definition in the web.xml. If use MessageDispatchServlet it do not accept the rest requests and if i use the DispatchServlet i can't handle the SOAP messages.
I've tried to use the DispatchServlet adding the beans of MessageFactory and WsdlHandler but then again it does not accept rest messages ( as before evaluating the inbound gateway it tries to handle the message as SOAP )
here is my spring-integration-servlet.xml :
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-http="http://www.springframework.org/schema/integration/http" xmlns:int-ws="http://www.springframework.org/schema/integration/ws" xmlns:int-xml="http://www.springframework.org/schema/integration/xml" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration/ws http://www.springframework.org/schema/integration/ws/spring-integration-ws-2.2.xsd http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.2.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.2.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http.xsd"> <int:channel id="receiveRestChannel"/> <int:channel id="responseRestChannel"/> <int-http:inbound-gateway id="RestEndpoint" request-channel="receiveRestChannel" name="/receiveGateway" supported-methods="GET, POST" reply-channel = "responseRestChannel"/> <beans:bean id="monkeyBusinessService" class="com.myapp.samples.samplehttp.impl.MonkeyBusiness"/> <int:chain id = "RestChain" input-channel = "receiveRestChannel" output-channel="responseRestChannel"> <int:json-to-object-transformer type="com.myapp.samples.samplehttp.RequestHttp"/> <int:service-activator ref="monkeyBusinessService" method="prueba"/> <int:object-to-json-transformer /> </int:chain> <!-- WS INBOUND GATEWAY --> <int-ws:inbound-gateway id="WsEndpoint" request-channel="receiveWsChannel" reply-channel="responseWSChannel" marshaller= "marshaller" unmarshaller= "unmarshaller" message-factory="messageFactory"/> <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/> <bean class="org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter"/> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="defaultHandler" ref="messageDispatcher"/> </bean> <bean id="messageDispatcher" class="org.springframework.ws.soap.server.SoapMessageDispatcher"/> <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/> <int:channel id="receiveWsChannel"/> <int:channel id="responseWSChannel"/> <oxm:jibx-marshaller id="unmarshaller" target-class="com.myapp.samples.samplehttp.RequestHttp"/> <oxm:jibx-marshaller id="marshaller" target-class="com.myapp.samples.samplehttp.ResponseHttp"/> <bean id="payloadMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping"> <property name="defaultEndpoint" ref="WsEndpoint" /> <property name="interceptors" ref="validatingInterceptor"/> </bean> <bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor"> <property name="xsdSchema" ref="schema" /> <property name="validateRequest" value="true" /> </bean> <bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema"> <property name="xsd" value="/WEB-INF/dataObjSchema.xsd" /> </bean> <bean id="sampleHttp" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition"> <property name="schema" ref="schema" /> <property name="portTypeName" value="Sample" /> <property name="requestSuffix" value="uestHttp"/> <property name="responseSuffix" value="ponseHttp"/> <!-- TODO change url --> <property name="locationUri" value="http://localhost:8080/http/SampleHttp" /> </bean> <int:service-activator id="wsActivator" input-channel="receiveWsChannel" output-channel="responseWSChannel" ref="monkeyBusinessService" method="prueba"/> </beans>
Thanks in advance to everyone , at least for reading...


Reply With Quote