【问题标题】:Issue with WSO2 ESB OutSequenceWSO2 ESB OutSequence 的问题
【发布时间】:2016-09-08 20:07:21
【问题描述】:

我在 REST API 中遇到了一些乱序问题。我的用例是我将收到 json 请求,调用一个服务,如果成功则调用第二个服务。现在我已经跳过了第一次服务响应的检查。我在 inSequence 中有一个端点,在 outSequence 中有另一个端点。 问题出在 outSequence 中,它进入了无限循环。

请让我知道我错过了什么。

<?xml version="1.0" encoding="UTF-8"?>
<api context = "/content_filter" hostname = "localhost" name = "Content_Filter" port = "8282" xmlns = "http://ws.apache.org/ns/synapse">
    <resource methods = "POST" protocol = "http" uri-template = "/test/content_filter">
        <inSequence>
            <property action = "remove" description = "REST_URL_POSTFIX" name = "REST_URL_POSTFIX" scope = "axis2"/>
            <payloadFactory description = "payLoad-modifier" media-type = "json">
                <format>{"SvcValidateRq": {"UserAccountInfo": {"UserID": "$1", "Password": "$2"}}}</format>
                <args>
                    <arg evaluator = "json" expression = "$.UserAccountInfo.UserID"/>
                    <arg evaluator = "json" expression = "$.UserAccountInfo.Password"/>
                </args>
            </payloadFactory>
            <property description = "message_type" name = "messageType" scope = "default" type = "STRING" value = "application/json"/>
            <property description = "content_type" name = "ContentType" scope = "axis2" type = "STRING" value = "application/json"/>
            <send>
                <endpoint>
                    <address format = "rest" trace = "disable" uri = "http://10.202.17.86:8085/UserInfo/rest/v1/login"/>
                </endpoint>
            </send>
        </inSequence>
        <outSequence>
            <log description = "output_logger" level = "full"/>
            <property description = "output_content" name = "ContentType" scope = "axis2" type = "STRING" value = "application/json"/>
            <payloadFactory description = "payload" media-type = "json">
                <format>{"SvcValidateRq": {"UserAccountInfo": {"UserID": "f987d3b2-f5bf-4cc7-83e2-c08322dfaac0", "Password": "23776BD42FEB4F06812F30A01FC7F6FD"}}}</format>
                <args/>
            </payloadFactory>
            <header description = "TimeStamp" name = "com.ugo.wallet.envelope.TimeStamp" scope = "transport" value = "7672387"/>
            <header description = "CorrelationID" name = "com.ugo.wallet.envelope.CorrelationID" scope = "transport" value = "9384982948"/>
            <header description = "TraceabilityID" name = "com.ugo.wallet.envelope.TraceabilityID" scope = "transport" value = "394892349"/>
            <send>
                <endpoint>
                    <address format = "rest" trace = "disable" uri = "http://10.202.17.86:8085/UserInfo/rest/v1/login"/>
                </endpoint>
            </send>
        </outSequence>
        <faultSequence>
            <log description = "error_log" level = "full"/>
            <property description = "error_content" name = "ContentType" scope = "axis2" type = "STRING" value = "application/json"/>
            <send/>
        </faultSequence>
    </resource>
</api>

下面是输出堆栈跟踪。

To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:77505542-4950-406c-95ff-b75541f03683, Direction: response, Payload: {"SvcValidateRs":{"Status":{"StatusCode":2,"Severity":"Error","StatusDesc":"Error","AdditionalStatus":[{"StatusCode":2036,"Severity":"Error","StatusDesc":"Invalid LoginID/Password","RefInfo":[{"KeyName":"FAILURE_INFO","KeyValue":["LoginID/Password is invalid."]},{"KeyName":"ORIGIN","KeyValue":["UserInfo.REST"]}]}]}}} {org.apache.synapse.mediators.builtin.LogMediator}
To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:cdfc7f8b-0517-407f-a081-5196610853c0, Direction: response, Payload: {"SvcValidateRs":{"Status":{"StatusCode":2,"Severity":"Error","StatusDesc":"Error","AdditionalStatus":[{"StatusCode":2036,"Severity":"Error","StatusDesc":"Invalid LoginID/Password","RefInfo":[{"KeyName":"FAILURE_INFO","KeyValue":["LoginID/Password is invalid."]},{"KeyName":"ORIGIN","KeyValue":["UserInfo.REST"]}]}]}}} {org.apache.synapse.mediators.builtin.LogMediator}
To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:049dd134-b29d-4abe-9653-0f3501a76e0a, Direction: response, Payload: {"SvcValidateRs":{"Status":{"StatusCode":2,"Severity":"Error","StatusDesc":"Error","AdditionalStatus":[{"StatusCode":2036,"Severity":"Error","StatusDesc":"Invalid LoginID/Password","RefInfo":[{"KeyName":"FAILURE_INFO","KeyValue":["LoginID/Password is invalid."]},{"KeyName":"ORIGIN","KeyValue":["UserInfo.REST"]}]}]}}} {org.apache.synapse.mediators.builtin.LogMediator}
To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:5156f9e8-5d6b-432b-b016-59175583b663, Direction: response, Payload: {"SvcValidateRs":{"Status":{"StatusCode":2,"Severity":"Error","StatusDesc":"Error","AdditionalStatus":[{"StatusCode":2036,"Severity":"Error","StatusDesc":"Invalid LoginID/Password","RefInfo":[{"KeyName":"FAILURE_INFO","KeyValue":["LoginID/Password is invalid."]},{"KeyName":"ORIGIN","KeyValue":["UserInfo.REST"]}]}]}}} {org.apache.synapse.mediators.builtin.LogMediator}

【问题讨论】:

    标签: wso2 wso2esb


    【解决方案1】:

    您需要从 out 序列中删除以下内容。在 ESB 中,当收到响应时,它将触发外序列,因此您会看到无限循环。您可以在顺序中使用调用中介而不是发送中介来避免这种情况。

    <send>
    <endpoint>
    <address format = "rest" trace = "disable" uri = http://10.202.17.86:8085/UserInfo/rest/v1/login"/>
    </endpoint>
    </send>
    

    以下是涵盖您的用例的好文章。

    http://wso2.com/library/articles/2014/02/service-orchestration-with-wso2-esb/

    【讨论】:

    • 感谢您的回复。
    【解决方案2】:

    感谢您的回复。 我不确定,但是当我使用呼叫调解器时,服务呼叫不会发生。但是事情与发送调解员一起工作。 我能够解决这个问题,inSequence 和 outSequence 中的 URL 都相同。我更改了 outSequence 的 URL,现在可以正常工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多