我正在尝试在Mule 3.3.2中创建SOAP Web服务。我正在使用cxf客户端代理来生成SOAP响应。我希望部分响应xml如下所示转义:
<?xml version="1.0" encoding="UTF-8"?>
<validateResponse xmlns="abc.exmaple.namespace">
<validateReturn>
<accordxmlresponse>
<?xml version="1.0" encoding="UTF-8"?>
<TXLife>
<TXLifeResponse>
</TXLifeResponse>
</TXLife>
</accordxmlresponse>
</validateReturn>
</validateResponse>
I created a transformer to do this using StringEscapeUtils.escapeXml(portionOfResponseXML). But mulesoft is giving me error
Caused by: org.apache.cxf.interceptor.Fault: COULD_NOT_READ_XML_STREAM
at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:133)
at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:117)
at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:113)
Caused by: com.ctc.wstx.exc.WstxParsingException: Illegal processing instruction target ("xml"); xml (case insensitive) is reserved by the specs.
at [row,col {unknown-source}]: [5,5]
at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:612)
at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:485)
at com.ctc.wstx.sr.BasicStreamReader.readPIPrimary(BasicStreamReader.java:3874)
I am not sure how to escape portion of my response xml. Could you please assist me on this.
Thanks