wso2 API管理器,通过招摇

时间:2017-07-20 04:08:00

标签: wso2 endpoint api-manager

我使用WSO2 API Manager创建了一个API,将我自己的java Restful Service添加为Endpoint。测试服务端点工作正常。 enter image description here 我正确地订阅了API,但是当使用swagger调用API时,它返回以下正文内容:

<!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>

应该返回application / xml媒体类型!

这是调用api后我招摇的屏幕截图

enter image description here

以下是直接从浏览器调用服务时的响应

enter image description here

我还将响应媒体类型更改为application / json,但它仍然有效。

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

问题是message和实际endpoint结尾处有request部分。这使得底层的电话变为

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

这是一个无效的网址。

解决方案很简单。从端点URL中删除messages部分。

即。端点网址应为http://localhost:8080/messanger/webapi/