我想知道WSO2 API Manager是否与基于Python和PHP的restful服务兼容? 我有几个基于JavaEE,Python和PHP开发的Web服务 除JavaEE外,没有其他平台与WSO2进行通信 在Python上,我在WSO2的POST请求中没有收到任何RAW有效负载。 这些服务工作正常,可以通过REST控制台与他们通信。
有关详细信息,请参阅我的其他STACKOVERFLOW POST。
我需要知道如何像JavaEE服务一样使用Python服务。
- 更新2 -
WSO2 AM和Python服务器都使用默认设置
WSO2日志 - Python服务器响应(服务器上没有TRY CATCH但是根本原因是空的有效负载)
{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>'http://19.190.11.98:8010/neu-cha/getResults'</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>'http://19.190.11.98:8010/neu-cha/getResults'</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服务代码:
使用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)
使用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)
这些服务工作正常,我可以通过Rest Console与他们沟通
但是通过WSO2的休息控制台,我无法将有效负载传递给服务。
有效负载要么空了,要么我得到格式错误请求错误。
我已根据solution在请求中添加了Content-Length 请求标头中的内容长度也为0,如 Content-Length:0
使用node.js和JEE进行的服务工作正常!!
为什么在WSO2中与Python进行通信时出现问题???