对 api 的直接请求可以正确响应,但 wso2 apim 网关不能正确响应

发布于 2025-01-13 06:27:09 字数 488 浏览 3 评论 0原文

我正在使用 wso2 apim 4.0.0。我遇到的问题是,当我向 api (http://localhost:7743/api/products) 本身发送直接请求时,它会正确响应(即返回产品列表)。

[
   {
    "id":1,
    "name":"a"
   },
   {
    "id":2,
    "name":"b"
   }
]

但是将该 api 发布到 apim 后,当我调用该 api (http://localhost:8243/api/products/v1) 时,它会不断返回“未找到”,这是不正确的。

{
    "statusCode": "404",
    "statusDescription": "Not found"
}

上面的响应来自我的 api 本身,而不是来自网关。 我取消选中发布者中的响应缓存,重新启动服务器。但一切都没有改变。

欢迎任何解决该问题的提示

I am using wso2 apim 4.0.0. The issue that I am stuck with is when I send a direct request to an api (http://localhost:7743/api/products) itself it response back properly (i.e. It returns list of products).

[
   {
    "id":1,
    "name":"a"
   },
   {
    "id":2,
    "name":"b"
   }
]

But after publishing that api to apim, when I invoke that api (http://localhost:8243/api/products/v1) it keeps giving back not found which is incorrect.

{
    "statusCode": "404",
    "statusDescription": "Not found"
}

The response above is coming from my api itself not from gateway.
I unchecked response caching in publisher, restarted the server. But nothing has changed.

Any hint to overcome the issue is welcomed

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想挽留 2025-01-20 06:27:09

网关端口默认为 8243。但您尝试使用端口 9443 调用它。更改端口值并重试。另外,请确保网关中部署了相关的 API。如果没有,即使 API 已发布,它也不会在网关中可用,并且您将无法获得正确的响应。

The gateway port is by default 8243. But you have tried to invoke it using port 9443. Change the port value and try it again. Also, ensure that the relevant API is deployed in the gateway. If not, even if the API is published it will not be available in the gateway and you won't be able to get the correct response.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文