Uploaded image for project: 'Synapse'
  1. Synapse
  2. SYNAPSE-1007

Enrich mediator does not enrich the message body when clone is set to 'false' and source type is set to 'property'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1
    • 3.0.0
    • Core

    Description

      If we try to enrich the a body with a property (where property type is set to 'OM') while setting clone to false, messages is not enriched.

      To illustrate this, consider the following synapse configuration.

      <?xml version="1.0" encoding="UTF-8"?>
      <definitions xmlns="http://ws.apache.org/ns/synapse">
         <proxy name="SYNAPSE1007" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
            <target>
               <inSequence>
                  <log level="custom">
                     <property name="SYNAPSE-1007" value="Bond, James Bond" />
                  </log>
                  <property name="PAYLOAD" expression="//payload/content" type="OM" />
                  <enrich>
                     <source type="property" clone="false" property="PAYLOAD" />
                     <target type="body" />
                  </enrich>
                  <header name="To" action="remove" />
                  <property name="RESPONSE" value="true" scope="default" type="STRING" />
                  <property name="NO_ENTITY_BODY" scope="axis2" action="remove" />
                  <send />
               </inSequence>
            </target>
            <description />
         </proxy>
      </definitions>

      Sending the following request:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <soapenv:Header/>
         <soapenv:Body>
            <payload>
               <content>
                  <abc>
                     <def>ABC</def>
                  </abc>
               </content>
            </payload>
         </soapenv:Body>
      </soapenv:Envelope>
      

      Yields:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <soapenv:Body>
            <payload>
               <content>
                  <abc>
                     <def>ABC</def>
                  </abc>
               </content>
            </payload>
         </soapenv:Body>
      </soapenv:Envelope>
      

      But the expected response should be

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <soapenv:Body>
            <content>
               <abc>
                  <def>ABC</def>
               </abc>
            </content>
         </soapenv:Body>
      </soapenv:Envelope>
      

      I've attached a fix for this issue (built against 2.1 branch) for you consideration.

      Attachments

        1. source-om-clone-true-enrich-fix.diff
          0.7 kB
          Ravi Undupitiya

        Activity

          People

            isudana Isuru Udana
            raviu Ravi Undupitiya
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: