在Wso2apimanager中找不到404

时间:2017-02-13 18:16:52

标签: wso2 wso2-am

我在wso2apimanager 1.7中创建了一个api,并通过创建应用程序订阅了创建的api。但是当我使用REST客户端(邮递员)调用api时,我收到了404 Not Found错误。

cURL请求

curl -X GET -H "Cache-Control: no-cache" -H "Authorization: Bearer f3afa04c46c95461ff2df4d037e9b2f" -H "Postman-Token: 8cb664dd-76ec-5ee1-40ee-ff27a1ce1942" "http://localhost:8280/test/path/V1/"

回复是

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>

下面是我的api定义xml

 <?xml version="1.0" encoding="UTF-8"?>
<api xmlns="http://ws.apache.org/ns/synapse"
     name="admin--TestingAPI"
     context="/test/path"
     version="V1"
     version-type="url">
   <resource methods="POST GET OPTIONS DELETE PUT"
             url-mapping="/*"
             faultSequence="fault">
      <inSequence>
         <send>
            <endpoint name="admin--TestingAPI_APIproductionEndpoint_0">
               <http uri-template="http://httpbin.org/ip"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </resource>
   <handlers>
      <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler"/>
   </handlers>
</api>

3 个答案:

答案 0 :(得分:1)

我认为问题在于您的后端服务。当您尝试http://httpbin.org/ip而不是http://localhost:8280/test/path/V1 时,它会给出404。 (注意结尾处的斜线)

因此,如果您将请求发送到以下网址,我认为应该可以。

import numpy as np
import pandas as pd

pos = pd.read_excel('pos.xls', header=None)

答案 1 :(得分:0)

您好像没有使用API​​上下文和/或其资源名称,请尝试使用它,否则,请提供您的API定义以及后端API详细信息以获得进一步的帮助。

答案 2 :(得分:0)

关注this教程,了解如何创建API。它适用于APIM 2.0.0,但技能可以转让。