一个仅添加身份验证的简单代理。
<?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来规范化消息吗?
发布于 2015-10-16 20:52:14
Axiom使用stax和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中创建一个包含以下内容的XMLOutputFactory.properties文件:com.ctc.wstx.outputEscapeCr=false,但在我的示例中,我无法再启动ESB_HOME ...
(有关详细信息,请参阅http://ws.apache.org/axiom/apidocs/org/apache/axiom/om/util/StAXUtils.html )
下面是我在调用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>希望您能够调整此脚本以满足您的需要。
发布于 2015-10-16 20:09:08
ESB的XML解析器(AXIOM)只是根据XML规范工作
http://www.w3.org/TR/REC-xml/#sec-line-ends
因此,XML解析器必须用LF代替CR-LF。在上面的XML规范中提到了这一点。
这就是在wso2企业服务总线中用LF代替CRLF的原因。
https://stackoverflow.com/questions/33148759
复制相似问题