WSO2 ESB代理CRLF规范化为LF

WSO2 ESB代理CRLF规范化为LF,wso2,axis2,wso2esb,Wso2,Axis2,Wso2esb,仅添加身份验证的简单代理 <?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="QueryTestProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">

仅添加身份验证的简单代理

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="QueryTestProxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property xmlns:ns="http://org.apache.synapse/xsd"
                   name="Authorization"
                   expression="fn:concat('Basic ', base64Encode(fn:concat('admin:', wso2:vault-lookup('QueryTest'))))"
                   scope="transport"
                   type="STRING"/>
         <send>
            <endpoint key="conf:/QueryTest"/>
         </send>
      </inSequence>
      <faultSequence>
         <send/>
      </faultSequence>
   </target>
   <publishWSDL key="conf:/WSDL/QueryTest.wsdl"/>
   <description/>
</proxy>

端点服务在其中一个字段上对CRLF进行拆分,并且端点不能修改,也不能使用CDATA

问题是WSO2 ESB总是用LF替换CRLF,并且拆分将不起作用,有人知道如何停止WSO2 ESB以规范化消息吗?

ESB的XML解析器(AXIOM)只是根据XML规范工作

所以XML解析器必须用LF替换CR-LF。上述XML规范中提到了这一点


这就是在wso2 ESB中将CRLF替换为LF的原因。Axiom使用stax并删除CR-LF中的那些CR

我在从如下生成的soap消息编写文本文件时遇到过类似问题:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:guid="http://com/cylande/unitedretail/guidedsale/service/common/GuidedSaleManagerService/">
   <soapenv:Header/>
   <soapenv:Body>
      <text xmlns="http://ws.apache.org/commons/ns/payload">my flat datas whith carriage return and line feeds</text>
   </soapenv:Body>
</soapenv:Envelope>

我的平面数据包含回车符和换行符
我们应该能够在ESB_HOME中创建一个XMLOutputFactory.properties文件来配置此行为,该文件的内容为:com.ctc.wstx.outputEscapeCr=false 但就我而言,我无法再启动ESB了

(有关更多详细信息,请参阅)

以下是我在调用send mediator之前在中介中添加的javascrip:

<script language="js"><![CDATA[
        try {           
            var payloadXML = mc.getPayloadXML();            
            var envelopeXML = mc.getEnvelope();         
            if (payloadXML != null) {               
                var text = payloadXML.toString();               
                if ((envelopeXML != null) && (envelopeXML.getBody() != null) && (envelopeXML.getBody().getFirstElement() != null))                          
    // Do not use mc.setPayloadXML(), it depends on Stax that delete the carriage return we are trying to add...
                    envelopeXML.getBody().getFirstElement().setText(text.replace(new RegExp('\n','g'),'\r\n'));         
            }       
        } catch (e) {           
        }
]]></script>


希望您能够根据需要调整此脚本。

我尝试使用javascript mediator,它将该节点文本中的LF替换为CRLF,但在发送消息时,会将其替换回LF。