ikedaSan
ikedaSan

Reputation: 51

WSO2 ESB 5.0 How to recover value xml element into cdata section?

Hello WSO2 ESB community,

We are new in WSO2. We need help to resolve this question. We've developed a proxy which receives a soap message like this.

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:es="http://es.ata"> 
    <soapenv:Header></soapenv:Header>
    <soapenv:Body>
         <es:rc>
           <es:xml><![CDATA[<message date="2017-03-02" id="ATA001">.....</message>]]></es:xml>
          <es:rc>
     </soapenv:Body>  
    </soapenv:Envelope>

How can we recover the attribute value "id"??

Anyone can help us??

Thanks in advance.

Upvotes: 0

Views: 766

Answers (1)

Jean-Michel
Jean-Michel

Reputation: 5946

Extract es:xml content in a property type OM (XML) and use XPath inside this content.

Send your payload to this sample proxy and have a look to wso2-esb-service.log, you will find "id = ATA001"

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="TestSOF" transports="http" startOnLoad="true" trace="disable">
    <description/>
    <target>
        <inSequence>
            <property xmlns:es="http://es.ata" name="CDATAPAYLOAD" expression="$body/es:rc/es:xml" type="OM"/>
            <property name="ID_VALUE" expression="get-property('CDATAPAYLOAD')/@id"/>
            <log level="custom">
                <property name="id" expression="get-property('ID_VALUE')"/>
            </log>
        </inSequence>
    </target>
</proxy>

Upvotes: 1

Related Questions