Search code examples
wso2apache-synapse

wso2/synapse service chaining: assign response from SOAP request as intput to another request


My desired sequence is the following:

  1. Read message from queue

  2. Transform

  3. Make an SOAP call

  4. Output SOAP response to another queue

Steps 1,2,3 work fine but when the message sent in Step 4, that I'm intending to contain the SOAP response, is empty. What am I doing wrong?

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
     name="JmsToWsdlJms" transports="https,http,jms"         statistics="disable" trace="disable" startOnLoad="true">
  <target>
    <inSequence>
       <enrich>
          <source type="body" clone="true"/>
          <target type="property" property="jms_body_text"/>
       </enrich>
       <property name="jms_body_text"
           expression="get-property('jms_body_text')"
           scope="default"/>
       <xslt key="jmsMsgToSoapMsg_xslt">
          <property name="jms_text" expression="get-property('jms_body_text')"/>
       </xslt>
       <log level="full">
          <property name="After transformation" value="****"/>
       </log>
       <send>
          <endpoint key="axisStockQuote"/>
       </send>
       <log level="full">
          <property name="After callout" value="****"/>
       </log>
       <property name="OUT_ONLY" value="true"/>
       <send>
          <endpoint key="jmsQueue2"/>
       </send>
    </inSequence>
  </target>
  <parameter name="transport.jms.ContentType">
   <rules>
     <jmsProperty>contentType</jmsProperty>
     <default>text/plain; charset=ISO-8859-1</default>
   </rules>
  </parameter>
  <parameter name="transport.jms.DestinationType">queue</parameter>
  <parameter name="transport.jms.Destination">cn=tro_Q_JMS1</parameter>
</proxy>

Solution

  • You can use 'send receive' instead of the send mediator. Something like,

    <send receive="jmsQueue2Sequence">
            <endpoint key="axisStockQuote"/>
        </send>
    

    So that the response of axisStockQuote will be sent to the jmsQueue2Sequence. Refer [1] for more info.

    [1] https://docs.wso2.com/display/ESB481/Send+Mediator