我碰到了我的端点,但是API管理器似乎在JSON到达之前就把它去掉了,所以它总是空的。我把它设置为一个生成和消费应用程序/json的帖子。我非常希望能够将JSON转储到请求体中,并将其传递到我的端点,而不进行转换。我的自吹自擂:
paths:
/consumers:
post:
responses:
'200':
description: ''
parameters:
- name: Payload
description: Request Body
required: true
in: body
schema:
type: object
properties:
mobile_phone_num:
type: string
produces:
- application/json
consumes:
- application/json
summary: Add a Spring consumer
x-auth-type: Application & Application User
x-throttling-tier: UnlimitedcUrl:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer eb29216f-134e-3fde-aa0d-88a513fb0bc8' -d '{"mobile_phone_num":"string"}' 'https://192.168.0.3:8243/burrito/1.0.0/consumers'还有那根电线:
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "OPTIONS /burrito/1.0.0/consumers HTTP/1.1[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Host: 192.168.0.3:8243[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Connection: keep-alive[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Access-Control-Request-Method: POST[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Origin: https://localhost:9443[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Access-Control-Request-Headers: authorization,content-type[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Accept: */*[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Referer: https://localhost:9443/store/apis/info?name=SpringConsumer&version=1.0.0&provider=admin&tenant=carbon.super[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Accept-Encoding: gzip, deflate, br[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Accept-Language: en-US,en;q=0.8[\r][\n]"
[2017-07-20 10:20:25,577] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "HTTP/1.1 200 OK[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Origin: https://localhost:9443[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Accept: */*[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Access-Control-Request-Method: POST[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Access-Control-Allow-Origin: *[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Access-Control-Allow-Methods: POST[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Access-Control-Request-Headers: authorization,content-type[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Referer: https://localhost:9443/store/apis/info?name=SpringConsumer&version=1.0.0&provider=admin&tenant=carbon.super[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Host: 192.168.0.3:8243[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Accept-Encoding: gzip, deflate, br[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Accept-Language: en-US,en;q=0.8[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Access-Control-Allow-Headers: authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Date: Thu, 20 Jul 2017 14:20:25 GMT[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Transfer-Encoding: chunked[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "Connection: keep-alive[\r][\n]"
[2017-07-20 10:20:25,581] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "[\r][\n]"
[2017-07-20 10:20:25,582] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "0[\r][\n]"
[2017-07-20 10:20:25,582] DEBUG - wire HTTPS-Listener I/O dispatcher-2 << "[\r][\n]"
[2017-07-20 10:20:25,584] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "POST /burrito/1.0.0/consumers HTTP/1.1[\r][\n]"
[2017-07-20 10:20:25,584] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Host: 192.168.0.3:8243[\r][\n]"
[2017-07-20 10:20:25,584] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Connection: keep-alive[\r][\n]"
[2017-07-20 10:20:25,584] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Content-Length: 38[\r][\n]"
[2017-07-20 10:20:25,584] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Accept: application/json[\r][\n]"
[2017-07-20 10:20:25,584] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Origin: https://localhost:9443[\r][\n]"
[2017-07-20 10:20:25,584] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36[\r][\n]"
[2017-07-20 10:20:25,584] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Authorization: Bearer 50d9345d-2c36-3cd7-a777-d94038538735[\r][\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Content-Type: application/json[\r][\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Referer: https://localhost:9443/store/apis/info?name=SpringConsumer&version=1.0.0&provider=admin&tenant=carbon.super[\r][\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Accept-Encoding: gzip, deflate, br[\r][\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "Accept-Language: en-US,en;q=0.8[\r][\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "[\r][\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "{[\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> " "mobile_phone_num": "1234567890"[\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "}"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "POST /consumer_api/v1/consumers HTTP/1.1[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Origin: https://localhost:9443[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Accept: application/json[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Referer: https://localhost:9443/store/apis/info?name=SpringConsumer&version=1.0.0&provider=admin&tenant=carbon.super[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Accept-Encoding: gzip, deflate, br[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Accept-Language: en-US,en;q=0.8[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Content-Type: application/json; charset=UTF-8[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Transfer-Encoding: chunked[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Host: consumer.lvh.me:3000[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Connection: Keep-Alive[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "[\r][\n]"
[2017-07-20 10:20:25,589] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "26[\r][\n]"
[2017-07-20 10:20:25,590] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "{[\n]"
[2017-07-20 10:20:25,590] DEBUG - wire HTTP-Sender I/O dispatcher-3 << " "mobile_phone_num": "1234567890"[\n]"
[2017-07-20 10:20:25,590] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "}[\r][\n]"
[2017-07-20 10:20:25,590] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "0[\r][\n]"
[2017-07-20 10:20:25,590] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "[\r][\n]"
[2017-07-20 10:20:25,640] DEBUG - wire HTTP-Sender I/O dispatcher-3 >> "HTTP/1.1 400 Bad Request[\r][\n]"更新-解析的
我的端点不喜欢分组请求。必须用以下内容更新序列文件:
<property name="FORCE_HTTP_1.0" value="true" scope="axis2" />
<property name="DISABLE_CHUNKING" value="true" scope="axis2" />现在起作用了。
发布于 2017-07-24 16:31:42
正如您在连线日志中看到的那样,APIM将json发送到后端,并返回一个400。
入站请求机构:
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "{[\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> " "mobile_phone_num": "1234567890"[\n]"
[2017-07-20 10:20:25,585] DEBUG - wire HTTPS-Listener I/O dispatcher-2 >> "}"出站请求机构:
[2017-07-20 10:20:25,590] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "{[\n]"
[2017-07-20 10:20:25,590] DEBUG - wire HTTP-Sender I/O dispatcher-3 << " "mobile_phone_num": "1234567890"[\n]"
[2017-07-20 10:20:25,590] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "}[\r][\n]"https://stackoverflow.com/questions/45215383
复制相似问题