要从WSO2 ESB / EI中的封装的ElementProperty中获取元素

问题描述 投票:0回答:1

我正在执行wso2 EI中的迭代和聚合操作。我想从聚合响应中获取元素值,聚合后不打印OUTSEQUENCE日志。有人可以帮助我找到此解决方案吗?

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>

                    <script language="js"><![CDATA[var log = mc.getServiceLog();
payload = mc.getPayloadJSON().toString(); log.info("payload::::" + payload); payloadRemoveSlash = payload.replace("\\", ""); mc.setProperty('payloadRemoveSlash',payloadRemoveSlash);]]></script>
                    <enrich>
                        <source clone="true" type="inline">
                            <test xmlns="">abc</test>
                        </source>
                        <target type="body"/>
                    </enrich>
                <!--
                DB Tracing (Response values stored in DB)-->
            </outSequence>
             </target>
    </proxy>

汇总响应:

[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\":\"[email protected]\",\"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\":\"[email protected]\",\"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\":\"[email protected]\",\"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>
iterator wso2 wso2esb aggregation wso2ei
1个回答
1
投票

代替在OnComplete中使用<send/>,请尝试使用<loopback/>。它可能会解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.