我有一个带vfs传输的WSO2ESB 4.7代理。我需要读一些像这样的xml文件:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Header PUBLIC "/usr/xxx.dtd" "/usr/xxx.dtd">
<Header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
代理:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="test" statistics="disable" trace="disable" transports="vfs">
<parameter name="transport.PollInterval">5</parameter>
<parameter name="transport.vfs.FileURI">C:\WSO2</parameter>
<parameter name="transport.vfs.FileNamePattern">.*[.][xX][mM][lL]$</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<log level="full"/>
<send>
<endpoint>
...
</endpoint>
</send>
</inSequence>
</target>
</proxy>
Wso2返回此错误:
[2013-10-15 11:23:03,670] ERROR - VFSTransportListener Error processing File URI : file:///C:/WSO2/1_CHRG_2713540.XML
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.axis2.builder.ApplicationXMLBuilder.processDocument(ApplicationXMLBuilder.java:81)
at org.apache.synapse.transport.vfs.VFSTransportListener.processFile(VFSTransportListener.java:574)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:324)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:158)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:107)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:36)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 13 more
是否有可能让wso2忽略Doctype?
我不想将文件读取为text / plain,删除doctype,转换为xml,使用它,转换为text / plain,添加doctype。
答案 0 :(得分:1)
将以下参数添加到代理服务。然后它将允许DOCTYPE声明
<parameter name="ApplicationXMLBuilder.allowDTD">true</parameter>