1 Reply Latest reply on Sep 15, 2016 4:31 AM by Tomohisa igarashi

    Issue with soap and jms binding switchyard

    ravi narayanan Expert

      Hi All,

      Iam trying to achieve the below scenario.

      I have a switchyard application with soap binding which puts the request in request Queue and waits for the response from response queue,request-reply pattern.i have another route In-only mep which picks the message from a queue process it and put the response in response queue both are separate threads.I have set the message ID as correlation ID in the route.But iam getting the response same as the request when i trigger soap request.Can you please tell me what is wrong?

       

      Switchyard.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <sy:switchyard xmlns:camel="urn:switchyard-component-camel:config:1.1" xmlns:jms="urn:switchyard-component-camel-jms:config:1.1" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:soap="urn:switchyard-component-soap:config:1.1" xmlns:sy="urn:switchyard-config:switchyard:1.1" name="switchyard-example-Test-Inout" targetNamespace="urn:com.example.switchyard:switchyard-example-Test-Inout:1.0">

        <sca:composite name="switchyard-example-Test-Inout" targetNamespace="urn:com.example.switchyard:switchyard-example-Test-Inout:1.0">

          <sca:component name="Component">

            <camel:implementation.camel>

              <camel:xml path="route.xml"/>

            </camel:implementation.camel>

            <sca:service name="CoreInsuranceSearch">

              <sca:interface.wsdl interface="wsdl/CoreInsuranceSearchInterface.wsdl#wsdl.porttype(CoreInsuranceSearchPortType)"/>

            </sca:service>

            <sca:reference name="ESBService">

              <sy:interface.esb inputType="java.lang.String" outputType="java.lang.String"/>

            </sca:reference>

          </sca:component>

          <sca:service name="CoreInsuranceSearch" promote="Component/CoreInsuranceSearch">

            <sca:interface.wsdl interface="wsdl/CoreInsuranceSearchInterface.wsdl#wsdl.porttype(CoreInsuranceSearchPortType)"/>

            <soap:binding.soap name="soap1">

              <soap:wsdl>wsdl/CoreInsuranceSearchInterface.wsdl</soap:wsdl>

              <soap:contextPath>switchyard-example-Test-Inout</soap:contextPath>

            </soap:binding.soap>

          </sca:service>

          <sca:reference name="ESBService" multiplicity="0..1" promote="Component/ESBService">

            <sy:interface.esb inputType="java.lang.String" outputType="java.lang.String"/>

            <jms:binding.jms name="jms1">

              <jms:contextMapper includes=".*"/>

              <jms:additionalUriParameters>

                <jms:parameter name="useMessageIDAsCorrelationID" value="true"/>

                <jms:parameter name="jmsMessageType" value="Text"/>

              </jms:additionalUriParameters>

              <jms:queue>Test.in.queue</jms:queue>

              <jms:connectionFactory>#ConnectionFactory</jms:connectionFactory>

              <jms:replyTo>Test.out.queue.debug</jms:replyTo>

              <jms:requestTimeout>5000</jms:requestTimeout>

            </jms:binding.jms>

          </sca:reference>

          <sca:component name="Component1">

            <camel:implementation.camel>

              <camel:xml path="routeTwo.xml"/>

            </camel:implementation.camel>

            <sca:service name="ESBServiceTwo">

              <sy:interface.esb inputType="java.lang.String"/>

            </sca:service>

            <sca:reference name="ESBServiceThree">

              <sy:interface.esb inputType="java.lang.String"/>

            </sca:reference>

          </sca:component>

          <sca:service name="ESBServiceTwo" promote="Component1/ESBServiceTwo">

            <sy:interface.esb inputType="java.lang.String"/>

            <jms:binding.jms name="jms1">

              <jms:contextMapper includes=".*"/>

              <jms:queue>Test.in.queue</jms:queue>

              <jms:connectionFactory>#ConnectionFactory</jms:connectionFactory>

            </jms:binding.jms>

          </sca:service>

          <sca:reference name="ESBServiceThree" multiplicity="0..1" promote="Component1/ESBServiceThree">

            <sy:interface.esb inputType="java.lang.String"/>

            <jms:binding.jms name="jms1">

              <jms:queue>Test.out.queue.debug</jms:queue>

              <jms:connectionFactory>#ConnectionFactory</jms:connectionFactory>

            </jms:binding.jms>

          </sca:reference>

        </sca:composite>

        <sy:domain>

          <sy:properties>

            <sy:property name="org.switchyard.handlers.messageTrace.enabled" value="true"/>

          </sy:properties>

        </sy:domain>

      </sy:switchyard>

       

      route.xml:

      <?xml version="1.0" encoding="ASCII"?>

      <routes xmlns="http://camel.apache.org/schema/spring">

        <route streamCache="true">

          <from uri="switchyard://CoreInsuranceSearch"/>

          <to uri="switchyard://ESBService"/>

        </route>

      </routes>

       

       

      routeTwo.xml 2:

      <?xml version="1.0" encoding="ASCII"?>

      <routes xmlns="http://camel.apache.org/schema/spring">

        <route streamCache="true">

          <from uri="switchyard://ESBServiceTwo"/>

          <log message="ESBService - message received: ${body}"/>

          <log message="message ID received: ${headers.JMSMessageID}"/>

          <setBody>

        <simple trim="false">You get some trailing whitespace characters.</simple>

              </setBody>

              <setHeader headerName="JMSCorrelationID">

        <simple>${headers.JMSMessageID}</simple>

              </setHeader>

               <log message="JMSCorrelationID Sent: ${headers.JMSCorrelationID}"/>

               

               <to uri="switchyard://ESBServiceThree"/>

               

        </route>

      </routes>

       

      Attached complete log with trace