2017-07-20 21 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