wso2esb 从 uri 中删除上下文路径

wso2esb remove context path from uri

我正在 wso2esb 中为其中一位租户定义 API。此租户在定义 API(例如 http://127.0.0.1:8280/tenant1/api-identifier/)时自动获取自己的上下文路径。

下一步是将此请求转发到无法给出响应的 http 端点(例如 http://127.0.0.1:9191/v1/). But when looking at the logs the esb tries to send this request to http://127.0.0.1:9191/v1/tenant1/api-identifier/。我可以从 url 中删除这部分吗?感觉是这样的开箱即用。

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
    <registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
        <parameter name="cachableDuration">1500</parameter>
    </registry>
    <taskManager provider="org.wso2.carbon.mediation.ntask.NTaskTaskManager"/>
    <sequence name="In">
        <log category="TRACE" level="full"/>
        <send>
            <endpoint key="gov:/HelloWorld"/>
        </send>
    </sequence>
    <sequence name="fault">
        <log level="full"/>
    </sequence>
    <sequence name="main">
        <in>
            <log/>
            <sequence key="conf:/InSecure"/>
        </in>
        <out>
            <send/>
        </out>
     </sequence>
     <sequence name="Out">
         <send/>
     </sequence>
     <sequence name="InSecure">
        <log/>
        <send>
            <endpoint key="gov:/HelloWorld"/>
         </send>
     </sequence>
     <api context="/lensworld.be/hw" hostname="192.168.1.100"
    name="HelloWorld" port="9191">
         <resource inSequence="InSecure" methods="GET" outSequence="Out"/>
    </api>

尝试删除 REST_URL_POSTFIX 属性:

<property name="REST_URL_POSTFIX" action="remove" scope="axis2"/>

来自the docs

The value of this property will be appended to the target URL when sending messages out in a RESTful manner through an address endpoint. This is useful when you need to append a context to the target URL in case of RESTful invocations. If you are using an HTTP endpoint instead of an address endpoint, specify variables in the format of "uri.var.*" instead of using this property.