Announcement Announcement Module
Collapse
No announcement yet.
Spring Integration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Integration

    Hi all,
    We have a SOA Service with multiple operations like

    service1
    operation1
    operation2

    We have declared an interface for this SOA Service in our code as

    IGatewaySer1 -> service1
    method1 -> operaion1
    method2 -> operation2

    In spring integration we have defininition like this


    <gateway service-interface="com.abc.IGatewaySer1 " id="operation1Gateway">
    <method name="operation1" request-channel="operationInChannel" reply-channel="operation!SOAOutChannel">
    </method>
    <method name="operation2" request-channel="operation2InChannel" reply-channel="operation2SOAOutChannel" >
    </method>
    <gateway/>


    When we invoke any one of the above methods we get org.springframework.beans.ConversionNotSupportedEx ception:

    Could any one suggest how to invoke multiple operations present in a single service

    Thanks,
    umaSankar

  • #2
    Hi!

    org.springframework.beans.ConversionNotSupportedEx ception
    Unfortunally, there is no enough info, to tetermine what's going on.
    Full StackTrace in the studio!


    Could any one suggest how to invoke multiple operations present in a single service
    It's normal use-case for Messaging Gateway: so, show more config, please

    Artem

    Comment


    • #3
      show more config,
      And the gateway method signatures.

      Comment


      • #4
        Hi Artem & ,Gary Russell Thanks for your response. I am giving below more details about the implementation.

        This is My Gateway inteface


        We are accessing SOAService http://http://soatest.xyz.com:8001/ViewService?wsdl

        which has operation 1.viewOperation1
        and 2.viewOperation2

        in our code a gatway Interface is declared as

        public interface IGatewayService{
        public JaxBResponseObject1 operaion1(FormModel1 formModel1) throws OurException; - should map to viewOperation1 in the SOA service
        public JaxBResponseObject2 operation2(FormModel2 formModel2)throws OurException; - should map to viewOperation2 in the SOA service
        }

        The formModel is our model class and the JaxBResponseObject1 is generated from the contract xsd

        public class ServiceClient {

        @Autowired
        IGatewayService gateWayService;

        public JaxBResponseObject1 op1(FormModel formModel1) throws OurException {
        return gateWayService.operation1(formModel1);
        }

        public JaxBResponseObject2 op2(FormModel2 formModel2) throws OurException {
        return gateWayService.operation2(formModel2);
        }
        `



        Below the Configuration file SpringIntegration.xml

        <gateway service-interface="com.abc.IGatewayService " id="gateWayService">
        <method name="operation1" request-channel="operationInChannel" reply-channel="operation1SOAOutChannel">
        </method>
        <method name="operation2" request-channel="operation2InChannel" reply-channel="operation2SOAOutChannel" >
        </method>
        <gateway/>

        <!-- Message Factory -->
        <beans:bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory">
        <beans:description>A message factory to support SOAP 1.1</beans:description>
        <beansroperty name="messageFactory">
        <beans:bean class="weblogic.xml.saaj.MessageFactoryImpl" />
        </beansroperty>
        </beans:bean>
        <!-- Soem Fault MessageResolver-->
        <beans:bean id="faultMessageResolver" class="com.abc.FaultMessageResolver"/>

        <!-- Transformer for conversions -->
        <beans:bean id="operationTransformer1" class="com.abc.OperationTransformer1"/>

        <!-- Start Operation1 -->
        <channel id="operationInChannel"/>
        <transformer id="someToSOATransformer"
        input-channel="operationInChannel"
        ref="operationTransformer1"
        method="operation1TransformModelToSOA"
        output-channel="operation1SOAInChannel"/>

        <channel id="operation1SOAInChannel"/>

        <ws:outbound-gateway uri="http://http://soatest.xyz.com:8001/ViewService?wsdl"
        marshaller="jaxb1Marshaller"
        unmarshaller="jaxb1Marshaller"
        message-factory="messageFactory"
        request-channel="operation1SOAInChannel"
        reply-channel="operation1SOAOutChannel"
        fault-message-resolver="faultMessageResolver"
        />

        <channel id="operation1SOAOutChannel"/>
        <oxm:jaxb2-marshaller id="jaxb1Marshaller">
        <oxm:class-to-be-bound name="com.abc.JaxBRequestObject1"/>
        <oxm:class-to-be-bound name="com.abc.JaxBResponseObject1"/>
        </oxm:jaxb2-marshaller>
        <!-- End Operation1 -->

        <!-- Transformer for conversions -->
        <beans:bean id="operationTransformer2" class="com.abc.OperationTransformer2"/>
        <channel id="operation2InChannel"/>
        <transformer id="some2ToSOATransformer"
        input-channel="operation2InChannel"
        ref="operationTransformer2"
        method="operation2TransformSpringToSOA"
        output-channel="operation2SOAInChannel"/>

        <channel id="operation2SOAInChannel"/>

        <ws:outbound-gateway uri="http://http://soatest.xyz.com:8001/ViewService?wsdl"
        marshaller="jaxb2Marshaller"
        unmarshaller="jaxb2Marshaller"
        message-factory="messageFactory"
        request-channel="operation2SOAInChannel"
        reply-channel="operation2SOAOutChannel"
        fault-message-resolver="opetaionsMessageResolver"
        />

        <channel id="operation2SOAOutChannel"/>
        <oxm:jaxb2-marshaller id="jaxb2Marshaller">
        <oxm:class-to-be-bound name="com.abc.JaxBRequestObject2"/>
        <oxm:class-to-be-bound name="com.abc.JaxBResponseObject2"/>
        </oxm:jaxb2-marshaller>




        OperationTransformer1.java
        ==========================
        public class OperationTransformer1 implements Serializable{

        public JaxBRequestObject1 operation1TransformSpringToSOA(FormModel1 formModel1){
        JaxbServiceRequest1 somerequest = new JaxbServiceRequest1();
        // convert the formModel1 to JaxbServiceRequest1 object
        return somerequest;
        }
        }
        OperationTransformer2.java
        ==========================
        public class OperationTransformer2 implements Serializable{

        public JaxBRequestObject2 operation2TransformSpringToSOA(FormModel formModel){
        JaxbServiceRequest2 somerequest = new JaxbServiceRequest2();
        // convert the formModel2 to JaxbServiceRequest2 object
        return somerequest;
        }
        }


        This is Exception we are getting:


        org.springframework.beans.ConversionNotSupportedEx ception: Failed to convert value of type 'com.abc.JaxBRequestObject2' to required type 'com.abc.JaxBResponseObject2'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.abc.JaxBRequestObject2] to required type [com.abc.JaxBResponseObject2]: no matching editors or conversion strategy found
        at org.springframework.beans.TypeConverterSupport.doC onvert(TypeConverterSupport.java:71)
        at org.springframework.beans.TypeConverterSupport.con vertIfNecessary(TypeConverterSupport.java:39)
        at org.springframework.integration.gateway.GatewayPro xyFactoryBean.convert(GatewayProxyFactoryBean.java :457)
        at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invokeGatewayMethod(GatewayProxyFact oryBean.java:313)
        at org.springframework.integration.gateway.GatewayPro xyFactoryBean.doInvoke(GatewayProxyFactoryBean.jav a:269)
        at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invoke(GatewayProxyFactoryBean.java: 260)
        at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
        at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy21.op1(Unknown Source)
        at com.abc.ServiceClient.op1(ServiceClient.java:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runRefle ctiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExpl osively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod .evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.e valuate(RunBefores.java:26)
        at org.springframework.test.context.junit4.statements .RunBeforeTestMethodCallbacks.evaluate(RunBeforeTe stMethodCallbacks.java:74)
        at org.junit.internal.runners.statements.RunAfters.ev aluate(RunAfters.java:27)
        at org.springframework.test.context.junit4.statements .RunAfterTestMethodCallbacks.evaluate(RunAfterTest MethodCallbacks.java:83)
        at org.springframework.test.context.junit4.statements .SpringRepeat.evaluate(SpringRepeat.java:72)
        at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:231)
        at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:88)
        at org.junit.runners.ParentRunner$3.run(ParentRunner. java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRu nner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRu nner.java:229)
        at org.springframework.test.context.junit4.statements .RunBeforeTestClassCallbacks.evaluate(RunBeforeTes tClassCallbacks.java:61)
        at org.springframework.test.context.junit4.statements .RunAfterTestClassCallbacks.evaluate(RunAfterTestC lassCallbacks.java:71)
        at org.junit.runners.ParentRunner.run(ParentRunner.ja va:309)
        at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.run(SpringJUnit4ClassRunner.java:174 )
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:50)
        at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:467)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:683)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)
        Caused by: java.lang.IllegalStateException: Cannot convert value of type [com.abc.JaxBRequestObject2] to required type [com.abc.JaxBResponseObject2]: no matching editors or conversion strategy found
        at org.springframework.beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:264)
        at org.springframework.beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:93)
        at org.springframework.beans.TypeConverterSupport.doC onvert(TypeConverterSupport.java:61)
        ... 41 more





        If a service has single operation then the same configuration works fine

        Thanks In Advance.
        Last edited by umasankar; Jul 16th, 2013, 09:13 AM.

        Comment


        • #5
          Hi!

          I don't understand "why", but your problem is here:
          HTML Code:
          <beans:bean id="operationTransformer2" class="com.abc.OperationTransformer2"/>
          
          <channel id="operation2InChannel"/>
          
          <transformer id="some2ToSOATransformer"
                    input-channel="operation2InChannel"
                    ref="operationTransformer1" !!! you declare "operationTransformer2" bean, but you stil continue use "operationTransformer1" !!!
                    method="operation2TransformSpringToSOA"
                    output-channel="operation2SOAInChannel"/>

          Comment


          • #6
            Hi Cleric, Thanks for your response.

            That is a Typo error while posting instead of operationTransformer2 i put it as operationTransformer1

            Below is the actual code

            <beans:bean id="operationTransformer2" class="com.abc.OperationTransformer2"/>

            <channel id="operation2InChannel"/>

            <transformer id="some2ToSOATransformer"
            input-channel="operation2InChannel"
            ref="operationTransformer2"
            method="operation2TransformSpringToSOA"
            output-channel="operation2SOAInChannel"/>
            Last edited by umasankar; Jul 16th, 2013, 10:04 AM.

            Comment


            • #7
              Sorry: no ideas.
              1. Add thisw to your SI-config:
              HTML Code:
              <logging-channel-adapter channel="loggerChannel" level="WARN" log-full-message="true"
              							 logger-name="139806_Spring_Integration"/>
              
              <message-history/>
              
              <wire-tap channel="loggerChannel"/>
              2. Send Message to your IGatewayService.operaion1
              3. get result and show here logs with message journey
              4. points 2 and 3 for IGatewayService.operaion2

              It's interest why your JaxBRequestObject2 returns to the operation2SOAOutChannel after <ws:outbound-gateway> instead of your JaxBResponseObject2...

              Comment

              Working...
              X