WSO2 EI-无法识别API上下文

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

我正在WSO2 EI 6.6中使用具有多个部分(/ context1 / context2 / ...)的API上下文开发API,我发现只有在具有/ context1这样的简单上下文的情况下,该API才有效。否则,当我调用API时,行为就好像与API的网址不匹配。

此功能在ESB 4.9中正常运行,在EI 6.6中构建时发现了此问题。

这里有一个样本无法使用此URL http://host:port/context1/context2/template

<api xmlns="http://ws.apache.org/ns/synapse" name="API1" context="/context1/context2">
   <resource methods="GET" uri-template="/template*">
      <inSequence>
        <send/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </resource>
</api>

以及一个使用URL http://host:port/context1/template正常运行的示例

<api xmlns="http://ws.apache.org/ns/synapse" name="API1" context="/context1">
   <resource methods="GET" uri-template="/template*">
      <inSequence>        
         <send/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </resource>
</api>

有帮助吗?我可以正确调用API吗?这是一个错误吗?

wso2 wso2esb wso2ei
1个回答
0
投票

我尝试了下面的API,它起作用了(http://localhost:8280/context1/context2/template2)。

<api xmlns="http://ws.apache.org/ns/synapse" name="API1" context="/context1/context2">
   <resource methods="GET" uri-template="/template*">
      <inSequence>
         <loopback/>
      </inSequence>
      <outSequence>
         <payloadFactory media-type="json">
            <format>{"Hello" : "World"}</format>
            <args/>
         </payloadFactory>
         <send/>
      </outSequence>
   </resource>
</api>

也许发送中介的行为已更改。您可以详细说明您要做什么吗?

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