WSO2 ESB HTTP端点URI参数

时间:2013-11-14 13:16:39

标签: wso2 wso2esb endpoint

我在WSO2 ESB(版本4.7.0)中定义了一个简单的API:

<api xmlns="http://ws.apache.org/ns/synapse" context="/test" name="TestAPI">
    <resource methods="GET" uri-template="/{param1}">
        <inSequence>
            <log category="INFO" level="custom" separator=",">
                <property expression="get-property('uri.var.param1')" name="Param1"/>
            </log>
            <send>
                <endpoint>
                    <http trace="enable" uri-template="http://localhost:8080/myservice/{uri.var.param1}/?aa=bb"/>
                </endpoint>
            </send>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
        <faultSequence/>
    </resource>
</api>

打电话时:

http://localhost:8280/test/VALUE

我看到,在来自ESB的日志中,似乎正在记录正确的参数并且正在调用正确的地址:

INFO {org.apache.synapse.mediators.builtin.LogMediator} -  Param1 = VALUE {org.apache.synapse.mediators.builtin.LogMediator}
INFO TRACE_LOGGER Sending message through endpoint : endpoint_d8f2411c6ce735d2f6cca8d2a23af16a89c0d34f6b95d560 resolving to address = http://localhost:8080/myservice/VALUE/?aa=bb

当我在服务端启用访问日志记录时出现错误,我看到请求有点不同:

"127.0.0.1" "NULL-AUTH-USER" "GET /myservice/VALUE/?aa=bb/VALUE HTTP/1.1" 200 220

问题是 - 为什么我会在网址末尾附加“/VALUE”以及如何摆脱它?

谢谢!

1 个答案:

答案 0 :(得分:2)

another question所述,它与REST_URL_POSTFIX变量相关。在端点解决问题之前清除它。