用于AXIS传输的WSO2 EI字符编码

时间:2019-08-27 10:28:21

标签: wso2 wso2esb axis2

我对WSO2 Enterprise Integrator 6.4中的消息传输的默认编码有疑问

服务器正在使用Java参数-Dfile.encoding = UTF8运行 Integration Studio完全位于UTF-8中

我用有效载荷工厂准备了有效载荷:

<property name="PAYLOAD" scope="default">
        <SomeRequest>
            <first_name>Čestmír</first_name>
            <last_name>Křepelka</last_name>               
        </SomeRequest>
</property>
<payloadFactory media-type="xml">
            <format>
                <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
                <soap:Body>                      
                                                 $1
                                    </soap:Body>
            </soap:Envelope>
        </format>
        <args>
            <arg evaluator="xml" expression="$ctx:PAYLOAD"/>
        </args>
</payloadFactory>
<log level="full">
        <property expression="//*" name="MessagePayload" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"/>
</log>

<call>
 <endpoint key="CommonEchoEndpoint"/>
</call>

日志返回:         

To: local:///services/CommonEchoProxy, WSAction: , SOAPAction: , MessageID: urn:uuid:3a4602f6-513e-4028-8335-6be39f3a024c, Direction: request, messageFormat = null, messageType = null, setCharacterEncoding = null, charsetEncoding = null, Envelope: 

<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <SomeRequest>
            <first_name>Čestmír</first_name>
            <last_name>Křepelka</last_name>
         <SomeResponse>
    </soap:Body>
</soap:Envelope>

但是...当我将其发送到目标端点时,它带有ISO8859-1编码,并且捷克字母坏了。

我试图将其设置为payloadfactory和call之间:

    <header name="Content-Type" scope="transport" value="application/soap+xml; charset=UTF-8"/>
    <header name="Encoding" scope="transport" value="UTF-8"/>
    <property name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>
    <property name="setCharacterEncoding" scope="axis2" type="STRING" value="true"/>
    <property name="CHARACTER_SET_ENCODING" scope="axis2" type="STRING" value="UTF-8"/>

它没有帮助。.

只有当我尝试将HEADER信息放在最后时,它才起作用,而我的请求是UTF-8

    <property name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>
    <property name="setCharacterEncoding" scope="axis2" type="STRING" value="true"/>
    <property name="CHARACTER_SET_ENCODING" scope="axis2" type="STRING" value="UTF-8"/>
    <header name="Content-Type" scope="transport" value="application/soap+xml; charset=UTF-8"/>
    <header name="Encoding" scope="transport" value="UTF-8"/>

为什么?为什么顺序很重要?

我在哪里可以将所有消息的默认编码设置为UTF-8,并且肯定要关闭ISO8859-1

谢谢!

马丁

0 个答案:

没有答案