WSO2 ESB 4.8.0 - 将XML转换为CSV时出现空白/纯文本响应

时间:2014-01-22 00:01:36

标签: wso2 wso2esb

我正在尝试将后端服务的响应从SOAP / XML转换为csv。 我使用xslt返回序列并将messageType属性设置为“text / plain”,如下所示:

<log level="full">
<property name="sequence" value="outSequence - transforming newhires xml to csv"></property>
</log>
<fastXSLT key="transform/newhires-to-csv.xslt"></fastXSLT>
<log level="full">
<property name="sequence" value="outSequence - returning response to client"></property>
</log>
<property name="messageType" value="text/plain" scope="axis2"></property>
<send></send>

如果我在浏览器中调用代理服务,我会收到一个空的200响应,其ContentType为:text / plain。日志显示:

To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:abe469ee-a0e4-4a59-9afb-c4ad513c500f, Direction: response, sequence = outSequence - returning response to client, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><text xmlns="http://ws.apache.org/commons/ns/payload"><?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>Michael,Peter,Simpson,Michael,1 Test Street,,TEST,0001,,1 Test Street,,TEST,0001,,,,MR,Male,2014-01-20Z,LTEBA,7098,EBA,G4,0,,24.58,1820,222301,MISS,A,A,Friend,A,,,,,1,1,b,1,2014-02-08Z,223173708 Wayne,G,Irwin,Wayne,1 Test Way,,TESTVILLE,0231,ACT,1 Test Way,,TESTVILLE,0231,ACT,61278963254,61412985672,MR,Male,1976-07-07Z,CSEBA,7098,EBA,G1C,1,,24.21,0,222301,MR,Snoopy,Dog,pet,kennel,022 596 3654,,,,733397,123456789,Wayne Irwin,0,2014-01-27Z,223193022 </soapenv:Body></soapenv:Envelope></text></soapenv:Body></soapenv:Envelope>

这显然是SOAP信封中的转换消息。我已经取消注释了文本消息构建器和消息转换器,所以这应该可以工作。

我还需要做些什么来让代理服务正确返回text / plain响应吗?感谢

2 个答案:

答案 0 :(得分:0)

通过转换,您应该生成如下文本节点:

<text xmlns="http://ws.apache.org/commons/ns/payload">Michael,Peter,Simpson,Michael,1 Test Street,,TEST,0001,,1 Test Street,,TEST,0001,,,,MR,Male,2014-01-20Z,LTEBA,7098,EBA,G4,0,,24.58,1820,222301,MISS,A,A,Friend,A,,,,,1,1,b,1,2014-02-08Z,223173708 Wayne,G,Irwin,Wayne,1 Test Way,,TESTVILLE,0231,ACT,1 Test Way,,TESTVILLE,0231,ACT,61278963254,61412985672,MR,Male,1976-07-07Z,CSEBA,7098,EBA,G1C,1,,24.21,0,222301,MR,Snoopy,Dog,pet,kennel,022 596 3654,,,,733397,123456789,Wayne Irwin,0,2014-01-27Z,223193022</text>

- &GT;删除<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">和相应的结束标记

答案 1 :(得分:0)

通过将fastXSLT介体交换为标准XSLT介体来管理解决此问题。出于某种原因,标准介体不包括soap信封,但是fastXSLT不包括。