1

我有一个带有 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。

4

1 回答 1

1

将以下参数也添加到代理服务。然后它将允许 DOCTYPE 声明

<parameter name="ApplicationXMLBuilder.allowDTD">true</parameter>  
于 2013-10-31T08:36:43.600 回答