2017-07-20 78 views
1

我使用WSO2 API Manager創建了一個API,將我自己的java Restful Service添加爲Endpoint。測試服務端點工作正常。 enter image description here 我訂閱了適當的API,但與招搖調用API,當它返回了以下機身內容:wso2 API管理器,通過Swagger調用API時找不到Restfull Endpoint

<!DOCTYPE html> 
<html> 
<head> 
<title>Apache Tomcat/8.0.45 - Error report</title> 
<style type="text/css"> 
H1 { 
font-family:Tahoma,Arial,sans-serif; 
color:white; 
background-color:#525D76; 
font-size:22px; 
} 
H2 { 
font-family:Tahoma,Arial,sans-serif; 
color:white; 
background-color:#525D76; 
font-size:16px; 
} 
H3 { 
font-family:Tahoma,Arial,sans-serif; 
color:white; 
background-color:#525D76; 
font-size:14px; 
} 
BODY { 
font-family:Tahoma,Arial,sans-serif; 
color:black; 
background-color:white; 
} 
B { 
font-family:Tahoma,Arial,sans-serif; 
color:white; 
background-color:#525D76; 
} 
P { 
font-family:Tahoma,Arial,sans-serif; 
background:white; 
color:black; 
font-size:12px; 
} 
A { 
color : black; 
} 
A.name { 
color : black; 
} 
.line { 
height: 1px; 
background-color: #525D76; 
border: none; 
} 
</style> 
</head> 
<body> 
<h1>HTTP Status 406 - Not Acceptable</h1> 
<div class="line"></div> 
<p><b>type</b> Status report</p> 
<p><b>message</b> <u>Not Acceptable</u></p> 
<p><b>description</b> <u>The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.</u></p> 
<hr class="line"> 
<h3>Apache Tomcat/8.0.45</h3> 
</body> 
</html> 

應用程序/ xml的媒體類型應該退換!

這裏是我招搖的屏幕截圖直接從瀏覽器

enter image description here

我也改變了調用該服務時調用API

enter image description here

這裏是響應後應用程序/ json的響應媒體類型,但它仍然沒有奏效。

有人可以幫我解決這個問題嗎?

回答

0

問題是你有message部分在endpoint和實際request的末尾。這使得下面的呼叫變爲

http://localhost:8080/messanger/webapi/messages/messages/ 

這是一個無效的URL。

解決方案很簡單。從端點URL中刪除messages部分。

即端點URL應爲http://localhost:8080/messanger/webapi/

+0

謝謝您的建議。我已將端點更改爲http:// localhost:8080/messenger/webapi /,但我仍然收到相同的錯誤代碼。 – edwing

+1

請啓用連線日誌並使用日誌更新您的問題。 http://lakshanigamage.blogspot.com/2015/03/how-to-enable-wire-logs-in-wso2-esbapim.html – Bee