是否可以处理来自Call Mediator的HTML响应?

时间:2019-06-12 17:17:04

标签: wso2 wso2ei synapse

无论我尝试了什么–将主体充实到STRING属性,并记录日志响应–我总是得到一个异常,这可能与html不是正确的xml有关。我根本不需要遍历html,只需要将其存储为字符串属性即可。

[2019-06-12 18:56:37,670] [-1234] [] [PassThroughMessageProcessor-80] ERROR {org.apache.synapse.transport.passthru.util.DeferredMessageBuilder} -  Error building message
org.apache.axis2.AxisFault: Invalid UTF-8 start byte 0xff (at char #1, byte #-1)
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at org.apache.axis2.builder.ApplicationXMLBuilder.processDocument(ApplicationXMLBuilder.java:88)
        at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:153)
        at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:163)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:116)
        at org.apache.synapse.mediators.AbstractListMediator.buildMessage(AbstractListMediator.java:145)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:94)
        at org.apache.synapse.mediators.filters.FilterMediator.mediate(FilterMediator.java:250)
        at org.apache.synapse.mediators.filters.FilterMediator.mediate(FilterMediator.java:242)
        at org.apache.synapse.mediators.eip.splitter.IterateMediator.mediate(IterateMediator.java:261)
        at org.apache.synapse.mediators.filters.FilterMediator.mediate(FilterMediator.java:242)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:267)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:783)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:281)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:570)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:193)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:263)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 start byte 0xff (at char #1, byte #-1)
        at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:536)
        at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:585)
        at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:610)
        at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:316)
        at org.apache.axiom.util.stax.wrapper.XMLInputFactoryWrapper.createXMLStreamReader(XMLInputFactoryWrapper.java:95)
        at org.apache.axiom.util.stax.wrapper.WrappingXMLInputFactory.createXMLStreamReader(WrappingXMLInputFactory.java:116)
        at org.apache.axiom.util.stax.wrapper.XMLInputFactoryWrapper.createXMLStreamReader(XMLInputFactoryWrapper.java:95)
        at org.apache.axiom.om.util.StAXUtils$1.run(StAXUtils.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:198)
        at org.apache.axis2.builder.ApplicationXMLBuilder.processDocument(ApplicationXMLBuilder.java:77)
        ... 20 more
Caused by: java.io.CharConversionException: Invalid UTF-8 start byte 0xff (at char #1, byte #-1)
        at com.ctc.wstx.io.UTF8Reader.reportInvalidInitial(UTF8Reader.java:303)
        at com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:397)
        at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:111)
        at com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:250)
        at com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:133)
        at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:531)
        ... 30 more
[2019-06-12 18:56:37,690] [-1234] [] [PassThroughMessageProcessor-80]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:94d02c25-5ddf-40c9-a7a4-a746fb28c797, Direction: request, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Error while building message. Error while building Passthrough stream, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope>

1 个答案:

答案 0 :(得分:0)

检查axis2.xml

这样的html mime类型应该为messageBuilder

    <messageBuilder contentType="text/html" 
                    class="org.apache.axis2.format.PlainTextBuilder"/>

如果未添加注释,但仍然出现错误,请检查mime-type标头作为响应。