简体   繁体   中英

To Fetch elements from enclosingElementProperty of aggregation in WSO2 ESB/EI

I am performing Iterate and Aggregation operation in wso2 EI . i want to fetch element values from aggregation response , OUTSEQUENCE log not printed after aggregation.Can anyone please help me to find this solution?

ProxyCode:

<proxy name="VBReadFromEmailBody" startOnLoad="true" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
        <target>
            <inSequence>
            <iterate expression="//jsonArray/jsonElement" id="LDVid" sequential="true">
                            <target>
                                <sequence>
                                    <sequence description="VBEmail_LDVNonQualifiedLead_Sequence" key="VBEmail_LDVNonQualifiedLead_Sequence"/>
                                </sequence>
                            </target>
                        </iterate>
                        <property name="Aggregated_Responses" scope="default">
                            <jsonObject/>
                        </property>
                        <aggregate id="LDVid">
                            <completeCondition>
                                <messageCount max="-1" min="-1"/>
                            </completeCondition>
                            <onComplete enclosingElementProperty="Aggregated_Responses" expression="$body/*[1]" xmlns:ns="http://org.apache.synapse/xsd">
                                <log level="full"/>
                            <loopback/>
                            </onComplete>
                        </aggregate>
                    </case>
                    <default/>
                </switch>
            </inSequence>
            <outSequence>
                <log level="custom">
                <property name="======OUTSEQUENCE=======" value="CALLED"/>
            </log>

                   <log level="full"/>
                <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
                <foreach expression="//jsonValue" id="foreach_id">
                    <sequence>
                        <log level="custom">
                            <property expression="json-eval($.)" name="====each payload===="/>
                        </log>
                        <script language="js"><![CDATA[var log = mc.getServiceLog();        
payload = mc.getPayloadJSON().toString();log.info("Logging payload;;;;" + payload); payloadRemoveSlash = payload.replace("\\", ""); mc.setProperty('payloadRemoveSlash',payloadRemoveSlash);]]></script>
                    </sequence>
                </foreach>
                <!--
                DB Tracing (Response values stored in DB)-->
            </outSequence>
             </target>
    </proxy>

Aggregated Response:

[2020-04-25 14:39:42,741] []  INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:516c93bf-fb2d-46af-8cc8-2b3e56a5e
7ef, Direction: response, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><jsonObject><jso
nValue>"{\"transactionId\":null,\"timestamp\":\"2020-04-25 19:09:41\",\"OpportunityId\":\"0065500000FyUJOAA3\",\"message\":\"Insert/Update success\",\"Lead\":{\"attributes\":{\"typ
e\":\"Lead\",\"url\":\"/services/data/v48.0/sobjects/Lead/00Q5500000AuBvGEAV\"},\"Company\":\"N/A\",\"Email\":\"jaxonstevens18@gmail.com\",\"Lead_Type__c\":\"Internet\",\"LeadSourc
e\":\"LDV i-Motor - Get a Quote\",\"FirstName\":\"Jaxon\",\"Account__c\":\"0015500000k8ow5AAA\",\"LastName\":\"Stevens\",\"Contact__c\":\"0035500000h2R5yAAE\",\"Id\":\"00Q5500000Au
BvGEAV\",\"MobilePhone\":\"+61 423 927 100\"},\"errorCode\":\"200\",\"appraisalId\":null}"</jsonValue><jsonValue>"{\"transactionId\":null,\"timestamp\":\"2020-04-25 19:09:42\",\"Op
portunityId\":\"0065500000FyUJYAA3\",\"message\":\"Insert/Update success\",\"Lead\":{\"attributes\":{\"type\":\"Lead\",\"url\":\"/services/data/v48.0/sobjects/Lead/00Q5500000AuBvLE
AV\"},\"Company\":\"N/A\",\"Email\":\"steveross01@bigpond.com\",\"Lead_Type__c\":\"Internet\",\"LeadSource\":\"LDV Facebook - Book a Test Drive\",\"FirstName\":\"Stephen\",\"Accoun
t__c\":\"0015500000k8opxAAA\",\"LastName\":\"Ross\",\"Contact__c\":\"0035500000h2R1wAAE\",\"Id\":\"00Q5500000AuBvLEAV\",\"MobilePhone\":\"+61 414 404 774\"},\"errorCode\":\"200\",\
"appraisalId\":null}"</jsonValue><jsonValue>"{\"transactionId\":null,\"timestamp\":\"2020-04-25 19:09:42\",\"OpportunityId\":\"0065500000FyUJTAA3\",\"message\":\"Insert/Update succ
ess\",\"Lead\":{\"attributes\":{\"type\":\"Lead\",\"url\":\"/services/data/v48.0/sobjects/Lead/00Q5500000AuBvQEAV\"},\"Company\":\"N/A\",\"Email\":\"dunleavy2010@hotmail.com\",\"Le
ad_Type__c\":\"Internet\",\"LeadSource\":\"LDV i-Motor - Get a Quote\",\"FirstName\":\"Brendan\",\"Account__c\":\"0015500000k8oVhAAI\",\"LastName\":\"Dunleavy\",\"Contact__c\":\"00
35500000h2Ql6AAE\",\"Id\":\"00Q5500000AuBvQEAV\",\"MobilePhone\":\"+61 449 819 834\"},\"errorCode\":\"200\",\"appraisalId\":null}"</jsonValue></jsonObject></soapenv:Body></soapenv:
Envelope>

Instead of using <send/> inside OnComplete, try using <loopback/> . It might resolve the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM