当前位置: 动力学知识库 > 问答 > 编程问答 >

json - Binary relay in wso2 api manager

问题描述:

We are using wso2 api manager to manage our REST apis. The default configuration in the api manager comes with org.wso2.carbon.relay.BinaryRelayBuilder for application/json content-type. I expect the whole data treated as binary and added to a payload node in the soap body. But when we try to send a request to the api manager, the whole request is converted into xml and wrapped by SOAP envelope. This was confirmed by logging the request inside the in-sequence of the proxy created by the api manager for this api, we could see the whole json request converted into xml.

Why does the API Gateway convert from json to xml when relay is used? Is there any configuration that we have to do to disable this xml processing in api manager?

Note: One of our APIs is a high throughput API. This json to xml conversion and then xml to json conversion will add extra load to our processing.

网友答案:

In which version of APIManager you see above issue? If you enabled the Binaryrelay message builders, you will only see the binary message content, when you use log mediator inside any sequence. Did you set the content type of your request properly, when you do POSTing? Please check the relay module conf is added in your axis2 configuration (axis2.xml)

  <module ref="relay"/>
网友答案:

I have found the solution for this. The binary relay happens in the API Manager only if we disable the relay module conf in axis2.xml.

<!--module ref="relay"/-->

By default it is enabled in version 1.3.0 and disabled in 1.3.1. But to make relay work for application/json content-type we have to disable this in addition to using the message builder/formatter of Binary relay. Not sure if this impacts anything else. This may be a bug in the API Manager.

分享给朋友:
您可能感兴趣的文章:
随机阅读: