1

I created an API with WSO2 API Manager adding my own java Restful Service as Endpoint. Testing the service endpoint worked fine. enter image description here I subscribed to the API properly but when invoking the API with the swagger it returns the following body content:

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

An application/xml media type is supposed to be returned!

Here is the screen shot of my swagger after calling the api

enter image description here

Here is the response when calling the service directly from the browser

enter image description here

I have also changed the response media type to application/json but it still did'nt worked too.

Can someone please help me to fix this problem?

BDL
  • 21,052
  • 22
  • 49
  • 55
edwing
  • 68
  • 3

1 Answers1

0

The issue is you have message part at the end of both endpoint and actual request. That makes the underneath call becomes

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

which is an invalid URL.

The solution is simple. Remove the messages part from the endpoint URL.

i.e. Endpoint URL should be http://localhost:8080/messanger/webapi/

Bee
  • 12,251
  • 11
  • 46
  • 73
  • Thank you for your proposition. i have changed my endpoints to http://localhost:8080/messenger/webapi/ but i am still getting the same Error Code. – edwing Jul 21 '17 at 00:04
  • 1
    Please enable wire logs and update your question with the logs. http://lakshanigamage.blogspot.com/2015/03/how-to-enable-wire-logs-in-wso2-esbapim.html – Bee Jul 21 '17 at 05:07