WSO2 API,总是 return JSON 没有 "Accept: application/json" header

WSO2 API, always return JSON without "Accept: application/json" header

使用 WSO2 Enterprise Integrator 6.6.0,有没有办法在不添加“接受:Application/json”的情况下始终 return JSON 而不是 XML header?

我尝试添加一个节点

<property description="output_content" name="ContentType" scope="axis2" type="STRING" value="application/json"/>

在序列中,但没有用。

您可以使用以下属性。

<property name="messageType" value="application/json" scope="axis2"/>

属性ContentType只有在属性messageType时才会生效,所以你需要两个,如下所示:

<property name="messageType" value="application/json" scope="axis2"/>
<property name="ContentType" value="application/json" scope="axis2"/>

messageType 属性 负责输出时使用的消息格式化程序。 您可以在此 WSO2 文档中阅读更多内容 Property messageType