0
votes

I am quite new to the WSO2 tools. I recently started using the WSO2 API Manager(ver. 3.1.0). I created an API gateway by importing the httpbin swagger specs: https://github.com/Azure/api-management-samples/blob/master/apis/httpbin.swagger.json. I published the API, subscribed to it, generated the API keys and started testing.

I imported the spec in Postman, configured the API key for authorization, changed the server to the local gateway http://localhost:8280/Api_Base/1.0

All the resources defined with GET method were accessible, but the POST, PUT and PATCH resources were not reachable via the gateway. I received the following error response "<faultstring>unknown" for these resources. I tried with cURL as well but got the same results. When I tried POST for httpbin directly it was working just fine:

curl --location --request POST 'http://httpbin.org/post'
{
  "args": {}, 
  "data": "", 
  "files": {}, 
  "form": {}, 
  "headers": {
    "Accept": "*/*", 
    "Host": "httpbin.org", 
    "User-Agent": "curl/7.58.0", 
    "X-Amzn-Trace-Id": "Root=1-5e8e0d39-ddf21f1055008f60707cf150"
  }, 
  "json": null, 
  "origin": "95.103.xxx.xxx", 
  "url": "http://httpbin.org/post"
}

and via my API gateway(with API key as well):

curl --location --request POST 'http://localhost:8280/HTTP_Bin_Mock/1.0/post'
<faultstring>unknown</faultstring>

What could have gone wrong?

1
I just tried out with the same swagger definition and I was able to invoke the /post resource successfully. Could you enable HTTP wire logs in Api gateway and check whether the backend response is received properly?menaka_
Yes, I figured out that when the payload is not empty it works for the 3 P-s . But by default there was no payload in the swagger spec.Andrej Rangelov

1 Answers

0
votes

please try below CURL command

curl --location --request POST 'http://localhost:8280/HTTP_Bin_Mock/1.0/post' --data '{}' --header 'Content-Type: Application/JSON'