WSO2 API Manager compatibility with Python

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 15:42:55

问题


I want to know if WSO2 API Manager is compatible with Python and PHP based restful services or not?
I have several webservices which are developed on JavaEE, Python and PHP.
Except JavaEE, no other platform is communicating with WSO2.
On Python, I don't receive any RAW payload in my POST requests from WSO2. These services are working fine and can communicate with them via REST Console.

Please see my other STACKOVERFLOW POST for details.

I need to know how I can consume Python services just like my JavaEE services.

--UPDATE 2--

Both WSO2 AM and Python server use default settings

WSO2 Log - Python server response (NO TRY CATCH at server but root cause id empty payload)

    {org.apache.synapse.transport.http.wire} -  >> "OPTIONS /npl/1.0.0/neu-cha/getResults HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Host: 19.190.11.17:8243[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Origin: https://19.190.11.17:9443[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Access-Control-Request-Method: POST[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Content-Length: 0[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Access-Control-Request-Headers: accept, origin, authorization, content-type[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Connection: keep-alive[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Accept: */*[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Referer: https://19.190.11.17:9443/store/apis/info?name=neuCha&version=1.0.0&provider=admin&[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Accept-Language: en-us[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Accept-Encoding: gzip, deflate[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "[\r][\n]" {org.apache.synapse.transport.http.wire}

{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> OPTIONS /npl/1.0.0/neu-cha/getResults HTTP/1.1 {org.apache.synapse.transport.http.headers}

{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Host: 19.190.11.17:8243 {org.apache.synapse.transport.http.headers}

{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Origin: https://19.190.11.17:9443 {org.apache.synapse.transport.http.headers}

{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Access-Control-Request-Method: POST {org.apache.synapse.transport.http.headers}

{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Content-Length: 0 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Access-Control-Request-Headers: accept, origin, authorization, content-type {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Connection: keep-alive {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Accept: */* {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Referer: https://19.190.11.17:9443/store/apis/info?name=neuCha&version=1.0.0&provider=admin& {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Accept-Language: en-us {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Accept-Encoding: gzip, deflate {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << HTTP/1.1 200 OK {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Origin: https://19.190.11.17:9443 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Accept: */* {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Access-Control-Request-Method: POST {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Access-Control-Allow-Origin: * {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Access-Control-Allow-Methods: GET,PUT,POST,DELETE,PATCH,OPTIONS {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Access-Control-Request-Headers: accept, origin, authorization, content-type {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Referer: https://19.190.11.17:9443/store/apis/info?name=neuCha&version=1.0.0&provider=admin& {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Host: 19.190.11.17:8243 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Accept-Encoding: gzip, deflate {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Accept-Language: en-us {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Access-Control-Allow-Headers: authorization,Access-Control-Allow-Origin,Content-Type {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Date: Wed, 27 Jul 2016 08:58:11 GMT {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Transfer-Encoding: chunked {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Connection: keep-alive {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.wire} -  << "HTTP/1.1 200 OK[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Origin: https://19.190.11.17:9443[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Accept: */*[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Access-Control-Request-Method: POST[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Access-Control-Allow-Origin: *[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Access-Control-Allow-Methods: GET,PUT,POST,DELETE,PATCH,OPTIONS[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Access-Control-Request-Headers: accept, origin, authorization, content-type[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Referer: https://19.190.11.17:9443/store/apis/info?name=neuCha&version=1.0.0&provider=admin&[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Host: 19.190.11.17:8243[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Accept-Encoding: gzip, deflate[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Accept-Language: en-us[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Access-Control-Allow-Headers: authorization,Access-Control-Allow-Origin,Content-Type[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Date: Wed, 27 Jul 2016 08:58:11 GMT[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Transfer-Encoding: chunked[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Connection: keep-alive[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "0[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "POST /npl/1.0.0/neu-cha/getResults HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Host: 19.190.11.17:8243[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Origin: https://19.190.11.17:9443[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Content-Type: application/json[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Accept-Language: en-us[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Accept-Encoding: gzip, deflate[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Connection: keep-alive[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Accept: application/json[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Authorization: Bearer c7648f6ee71099c2e4779dda1d4f5bdf[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Referer: https://19.190.11.17:9443/store/apis/info?name=neuCha&version=1.0.0&provider=admin&[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Content-Length: 22[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> POST /npl/1.0.0/neu-cha/getResults HTTP/1.1 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Host: 19.190.11.17:8243 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Origin: https://19.190.11.17:9443 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Content-Type: application/json {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Accept-Language: en-us {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Accept-Encoding: gzip, deflate {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Connection: keep-alive {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Accept: application/json {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Authorization: Bearer c7648f6ee71099c2e4779dda1d4f5bdf {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Referer: https://19.190.11.17:9443/store/apis/info?name=neuCha&version=1.0.0&provider=admin& {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 >> Content-Length: 22 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.wire} -  >> "{"query":"b'day card"}" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> POST /neu-cha/getResults HTTP/1.1 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> Origin: https://19.190.11.17:9443 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> Accept: application/json {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> Referer: https://19.190.11.17:9443/store/apis/info?name=neuCha&version=1.0.0&provider=admin& {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> Accept-Encoding: gzip, deflate {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> Accept-Language: en-us {org.apache.synapse.transport.http.headers}

{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> Content-Type: application/json; charset=UTF-8 {org.apache.synapse.transport.http.headers}

{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> Transfer-Encoding: chunked {org.apache.synapse.transport.http.headers}

{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> Host: 19.190.11.98:8010 {org.apache.synapse.transport.http.headers}

{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> Connection: Keep-Alive {org.apache.synapse.transport.http.headers}

{org.apache.synapse.transport.http.headers} -  http-outgoing-5 >> User-Agent: Synapse-PT-HttpComponents-NIO {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.wire} -  << "POST /neu-cha/getResults HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Origin: https://19.190.11.17:9443[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Accept: application/json[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Referer: https://19.190.11.17:9443/store/apis/info?name=neuCha&version=1.0.0&provider=admin&[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Accept-Encoding: gzip, deflate[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Accept-Language: en-us[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Content-Type: application/json; charset=UTF-8[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Transfer-Encoding: chunked[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Host: 19.190.11.98:8010[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "16[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "{"query":"b'day card"}[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "0[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "HTTP/1.0 400 Bad Request[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Server: PasteWSGIServer/0.5 Python/2.7.11[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Date: Wed, 27 Jul 2016 08:58:15 GMT[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Content-Length: 767[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "Content-Type: text/html; charset=UTF-8[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "    <html>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "        <head>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "            <title>Error: 400 Bad Request</title>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "            <style type="text/css">[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "              html {background-color: #eee; font-family: sans;}[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "              body {background-color: #fff; border: 1px solid #ddd;[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "                    padding: 15px; margin: 15px;}[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "              pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "            </style>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "        </head>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "        <body>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "            <h1>Error: 400 Bad Request</h1>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "            <p>Sorry, the requested URL <tt>&#039;http://19.190.11.98:8010/neu-cha/getResults&#039;</tt>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "               caused an error:</p>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "            <pre>Error while parsing chunked transfer body.</pre>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "        </body>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  >> "    </html>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 << HTTP/1.0 400 Bad Request {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 << Server: PasteWSGIServer/0.5 Python/2.7.11 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 << Date: Wed, 27 Jul 2016 08:58:15 GMT {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 << Content-Length: 767 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-outgoing-5 << Content-Type: text/html; charset=UTF-8 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << HTTP/1.1 400 Bad Request {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Access-Control-Allow-Origin: * {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Access-Control-Allow-Methods: POST {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Access-Control-Allow-Headers: authorization,Access-Control-Allow-Origin,Content-Type {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Content-Type: text/html; charset=UTF-8 {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Date: Wed, 27 Jul 2016 08:58:11 GMT {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Transfer-Encoding: chunked {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.headers} -  http-incoming-9 << Connection: Close {org.apache.synapse.transport.http.headers}
{org.apache.synapse.transport.http.wire} -  << "HTTP/1.1 400 Bad Request[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Access-Control-Allow-Origin: *[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Access-Control-Allow-Methods: POST[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Access-Control-Allow-Headers: authorization,Access-Control-Allow-Origin,Content-Type[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Content-Type: text/html; charset=UTF-8[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Date: Wed, 27 Jul 2016 08:58:11 GMT[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Transfer-Encoding: chunked[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "Connection: Close[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "2ff[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "    <html>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "        <head>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "            <title>Error: 400 Bad Request</title>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "            <style type="text/css">[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "              html {background-color: #eee; font-family: sans;}[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "              body {background-color: #fff; border: 1px solid #ddd;[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "                    padding: 15px; margin: 15px;}[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "              pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "            </style>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "        </head>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "        <body>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "            <h1>Error: 400 Bad Request</h1>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "            <p>Sorry, the requested URL <tt>&#039;http://19.190.11.98:8010/neu-cha/getResults&#039;</tt>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "               caused an error:</p>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "            <pre>Error while parsing chunked transfer body.</pre>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "        </body>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "    </html>[\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "0[\r][\n]" {org.apache.synapse.transport.http.wire}
{org.apache.synapse.transport.http.wire} -  << "[\r][\n]" {org.apache.synapse.transport.http.wire}

Python Service Code:

Using Django

from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
def path(request):
    try:
        print request
        if request.method == 'GET':
            return HttpResponse("Hello GET Django")
        elif request.method =='POST':
            print request.body #ERROR OCCURS HERE
            return HttpResponse(request.body)
    except Exception, e:
        print e
        return HttpResponse(e)

Using Google App Engine

import webapp2

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write('Hello app world!')


class PostHandler(webapp2.RequestHandler):
    def post(self):
        data = self.request.body #ERROR OCCURS HERE
        print data
        self.response.write('SUCCESS')


app = webapp2.WSGIApplication([
    ('/', MainHandler),
    ('/data', PostHandler)
], debug=True)

These services are working fine and I am able to communicate with them via Rest Console.
But through WSO2's rest console, I am unable to pass my payload to service.
Payload either comes empty or I get Malformed Request Error.

I have added Content-Length in request as per solution Still content length in request header also comes 0 like Content-Length: 0

Services made using node.js and JEE works fine!!

Why there is issue communicating with Python from WSO2???

来源:https://stackoverflow.com/questions/38451304/wso2-api-manager-compatibility-with-python

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