2017-02-13 36 views
0

我在wso2apimanager 1.7中創建了api,並通過創建應用程序來訂閱創建的api。但是當我使用REST客戶端(郵遞員)調用API時,我得到了404 Not Found錯誤。404在Wso2apimanager中找不到

捲曲請求

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> 
+2

plase分享你的api定義xml。 –

+0

任務編輯。提前致謝。 – drafterr

+1

你是如何創建這個API的?爲什麼我看不到其他默認處理程序? – Bee

回答

0

看起來你沒有使用API​​上下文和/或它的資源名稱,請嘗試一下,否則請提供您的API定義以及後端API詳細信息以獲得進一步的幫助。

0

跟着this教程來了解如何創建一個API。它適用於APIM 2.0.0,但技能可以轉讓。

1

我認爲問題出在您的後端服務上。當您嘗試http://httpbin.org/ip/而不是http://httpbin.org/ip時,它會給出404。 (注意最後的斜線)

所以如果你發送你的請求到下面的URL,它應該工作我認爲。

http://localhost:8280/test/path/V1 
+0

是的。 api出了問題。謝謝。它爲另一個API工作。 – drafterr

+0

這是結尾'/' – Bee