WSO2 API POST Python Web Service - Empty or No Payload to server

独自空忆成欢 提交于 2019-12-12 03:44:49

问题


I am not able to send request payload to my POST service from WSO2.
On rest console, my service is working.
From WSO2 server I am able to do curl to my server with successful response.

here is my API configuration
Payload to send:

{"query":"Hi I am a POST query parameter"}

My server is receiving {} as request payload.
It expect RAW body in JSON (as above) in payload.
I have tried all combinations for Parameter Type, but still not able to send payload to my server from WSO2.

How can I do this?

EDIT 1 I have tried all possible ways of sending data including following. Am I doing something wrong here???

and

From both I get error that my payload is empty or incorrect!!

Edit 2
I am able to connect with Java based services but not with Python based services.
Do I need any special settings on my python server?


回答1:


enable wirelogs and check following

  1. payload is coming into the API manager (swagger -> AM )
  2. Payload is going out from api manager (AM -> backend)

Also check the request headers coming in and going out and compare them with the stuff from curl request (successful request)




回答2:


I am using Flask and I am afraid Flask can not deal with this issue currently.

I could reproduce this issue, the message send to back-end correctly, but Python only handle message until timeout.

Python Flask cannot receive post request from WSO2

The work-round may be using Java or Python get method.




回答3:


I solved this problem by using apache to proxy this request. I think this is related with wsgi. Processing chunked encoded HTTP POST requests in python (or generic CGI under apache)

ProxyPass / http://localhost:8001/
ProxyPassReverse / http://localhost:8001/


来源:https://stackoverflow.com/questions/37966488/wso2-api-post-python-web-service-empty-or-no-payload-to-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!