首页 > 解决方案 > WSO2 APIM 2.6.0 使用 RestAPI 发布 API

问题描述

我最近将 WSO2 APIM 从 2.5.0 升级到 2.6.0

目前,执行基本测试并且一切正常。我也在使用 MSSQL 数据库。

现在,使用 restAPIs,我在发布者中创建 API,然后发布 API。这两个功能都运行良好。但是,我在调用 API 时确实看到了一个问题。

因此,为了测试它,我订阅了已发布的 API,并使用正确的令牌调用它。首次调用 API 时,出现以下错误

    TID: [-1234] [] [2019-10-08 14:58:16,263]  WARN {org.wso2.carbon.apimgt.keymgt.service.thrift.APIKeyValidationServiceImpl} -  Invalid session id for thrift authenticator. {org.wso2.carbon.apimgt.keymgt.service.thrift.APIKeyValidationServiceImpl}
    TID: [-1234] [] [2019-10-08 14:58:16,263] ERROR {org.wso2.carbon.apimgt.keymgt.service.thrift.APIKeyValidationServiceImpl} -  Error in invoking validate key via thrift.. {org.wso2.carbon.apimgt.keymgt.service.thrift.APIKeyValidationServiceImpl}
    TID: [-1234] [] [2019-10-08 14:58:16,264]  WARN {org.wso2.carbon.apimgt.gateway.handlers.security.thrift.ThriftKeyValidatorClient} -  Login failed.. Authenticating again.. {org.wso2.carbon.apimgt.gateway.handlers.security.thrift.ThriftKeyValidatorClient}
    TID: [-1234] [] [2019-10-08 14:58:16,338]  INFO {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} -  'admin@carbon.super [-1234]' logged in at [2019-10-08 14:58:16,338+0000] from IP address  {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil}
    TID: [-1234] [] [2019-10-08 14:58:16,370]  WARN {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} -  API authentication failure due to No matching resource found in the API for the given request {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler}

然后,随后的调用在下面给出

    TID: [-1234] [] [2019-10-08 14:59:29,462]  WARN {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} -  API authentication failure due to No matching resource found in the API for the given request {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler}

现在,我要做的是从 /publisher 门户重新发布 API,然后使用相同的 oauth 令牌再次调用它,它可以正常工作,没有任何问题。

有人可以在这里帮助我吗?有人在 2.6.0 中遇到过这个问题吗?

谢谢

标签: wso2wso2-amwso2carbon

解决方案


“API 身份验证失败,因为在给定请求的 API 中找不到匹配的资源”

原因是调度 API 调用请求后资源验证失败。并且可能是由于在数据库中找不到对应的API资源或者资源不明确的场景。因此,请在发布并通过 Rest API 调用 API 后检查数据库中是否存在确切的资源。


推荐阅读