如何在WSO2 ESB中删除charset = utf-8

时间:2017-09-21 02:37:04

标签: wso2 wso2esb

我需要调用rest服务,它在标头中接受“Content-Type:application / json”,但是当我尝试从ESB调用它时。 WSO2自动添加“charset = utf-8”。我不知道如何删除它。

我也使用了ContentType属性,但没有运气。

     <property name="HTTP_METHOD" scope="axis2" type="STRING" value="PUT"/>
<property name="ContentType" scope="axis2" type="STRING" value="application/json"/>
                     <header expression="fn:concat('Basic ', get-property('ENCODED_URL'))" name="Authorization" scope="transport" xmlns:ns="http://org.apache.synapse/xsd"/>
                     <payloadFactory media-type="json">
                        <format>{
                                    "name": "XXX_Token",
                                    "type": "XXXX-cf04186e2156_sessionID",
                                    "version": "1.0.1",
                                    "Attribute-N": $1
                                    }
                        </format>
                        <args>
                                <arg expression="$ctx:XXXTokenValue" literal="false" />
                        </args>
                    </payloadFactory>
                     <property name="REST_URL_POSTFIX" scope="axis2" value=""/>
                    <call>
                        <endpoint>
                            <address trace="disable" uri="https://XXXXX:9493/governance/restservices/52b1caba-b507-4f6a-95bc-2ea7b2418e67"/>
                        </endpoint>
                    </call>

日志:

 -  End : Call mediator - Non Blocking Call
TID: [-1] [ESB] [2017-09-21 14:30:37,785] DEBUG {org.apache.synapse.transport.http.wire} -  << "PUT /governance/restservices/5XXXXX2ea7b2418e67 HTTP/1.1[\r][\n]"
TID: [-1] [ESB] [2017-09-21 14:30:37,785] DEBUG {org.apache.synapse.transport.http.wire} -  << "X-AspNet-Version: 4.0.30319[\r][\n]"
TID: [-1] [ESB] [2017-09-21 14:30:37,785] DEBUG {org.apache.synapse.transport.http.wire} -  << "Authorization: Basic YWRtaW46YWRtaW4=[\r][\n]"
TID: [-1] [ESB] [2017-09-21 14:30:37,785] DEBUG {org.apache.synapse.transport.http.wire} -  << "Content-Type: application/json; charset=utf-8[\r][\n]"
TID: [-1] [ESB] [2017-09-21 14:30:37,785] DEBUG {org.apache.synapse.transport.http.wire} -  << "X-Powered-By: ASP.NET[\r][\n]"
TID: [-1] [ESB] [2017-09-21 14:30:37,785] DEBUG {org.apache.synapse.transport.http.wire} -  << "Cache-Control: private, max-age=0[\r][\n]"
TID: [-1] [ESB] [2017-09-21 14:30:37,785] DEBUG {org.apache.synapse.transport.http.wire} -  << "Transfer-Encoding: chunked[\r][\n]"
TID: [-1] [ESB] [2017-09-21 14:30:37,785] DEBUG {org.apache.synapse.transport.http.wire} -  << "Host: XXXXXXz:9493[\r][\n]"
TID: [-1] [ESB] [2017-09-21 14:30:37,785] DEBUG {org.apache.synapse.transport.http.wire} -  << "Connection: K

1 个答案:

答案 0 :(得分:1)

这是ESB 4.9.0 [1]中的一个错误。这可能已在以后的版本中修复。

请检查“/repository/conf/passthru-http.properties”中是否有以下属性

http.headers.preserve = Content-Type

(请注意,您可以添加多个标头值作为逗号分隔列表)

顺便说一下,使用属性“messageType”来设置内容类型。请参考[2]

中的messageType和ContentType上的文档

[1] https://wso2.org/jira/browse/ESBJAVA-4620

[2] https://docs.wso2.com/display/ESB500/Generic+Properties#GenericProperties-messageType