数据未在wso2 esb编排中到达我的端点

时间:2018-05-28 09:12:46

标签: wso2 esb orchestration

我是WSO2和ESB的新手,但我有一个序列,它接受一个json数据并将该json数据中的值发送到我的end point msf4j-spring微服务,该服务接受一个字符串,返回一个字符串,我的insequence似乎能够找到正在运行的微服务但我无法发送数据服务进行处理。我知道我做错了什么但我不知道它是什么。

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="mainServiceRouteSeq" trace="enable" xmlns="http://ws.apache.org/ns/synapse">
<property expression="json-eval($.type)" name="postParam"
    scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<log level="custom">
    <property expression="$ctx:postParam"
        name="########RouteServiceLogs" xmlns:ns="http://org.apache.synapse/xsd"/>
</log>
<switch source="json-eval($.type)" xmlns:ns="http://org.apache.synapse/xsd">
    <case regex="foo">
        <log>
            <property name="+RouteSeq" value="FOO"/>
            <property expression="json-eval($)" name="sending uri.data"/>
        </log>
        <property expression="json-eval($)" name="uri.data"
            scope="default" type="STRING"/>
        <call>
            <endpoint>
                <address format="rest" uri="http://localhost:9090/out/encrypt"/>
            </endpoint>
        </call>
        <property expression="json-eval($)" name="RESPONSE2"
            scope="default" type="STRING"/>
        <log level="custom">
            <property expression="get-property('RESPONSE2')" name="LOG_RESPONSE2"/>
        </log>
    </case>
    <case regex="bar">
        <log>
            <property name="-RouteSeq" value="BAR"/>
            <property expression="json-eval($)" name="sending uri.data"/>
        </log>
        <property expression="json-eval($)" name="uri.data"
            scope="default" type="STRING"/>
        <send>
            <endpoint>
                <address format="rest" uri="http://localhost:9090/out/encrypt"/>
            </endpoint>
        </send>
        <log level="full"/>
        <property expression="json-eval($)" name="RESPONSE2"
            scope="default" type="STRING"/>
        <log level="custom">
            <property expression="get-property('RESPONSE2')" name="LOG_RESPONSE2"/>
        </log>
    </case>
    <default/>
</switch>
</sequence>

1 个答案:

答案 0 :(得分:0)

经过长时间的阅读和理解wso2语法。在删除我的API序列中的url-mapping之后,下面是我的问题的解决方案,因为它干扰了我的调用中介,并且我将blocking添加为true,以便我的调用是同步的

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="balanceEnquirySeqIN" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="custom">
    <property expression="json-eval($.)" name="in_request"/>
</log>
<switch source="json-eval($.agentInstitutionCode)">
    <case regex="001">
        <payloadFactory media-type="json">
            <format>{


                "channel": "",
                "type": "",
                "customerId": "$1",
                "customerIdType": "",
                "submissionTime": "",
                "reqTranId": "$2",
                "passcode": ""

                }
            </format>
            <args>
                <arg evaluator="json" expression="$.agentAccountNumber"/>
                <arg evaluator="json" expression="$.requestID"/>
            </args>
        </payloadFactory>
        <log level="custom">
            <property expression="json-eval($.)" name="CHANGED_REQUEST"/>
        </log>
        <call blocking="true"/>
        <property name="messageType" scope="default" type="STRING" value="application/json"/>
        <log level="custom">
            <property expression="json-eval($.)" name="DATA_RETURNED"/>
        </log>
        <enrich>
            <source clone="true" type="inline">
                <direct xmlns="">001</direct>
            </source>
            <target action="child" type="body"/>
        </enrich>
        <log level="full">
            <property expression="json-eval($.)" name="msg2"/>
        </log>
        <loopback/>
    </case>

  </switch>
</sequence>