休息服务

时间:2016-04-27 07:45:15

标签: wso2 wso2-am

我使用全局传出日志中介,以便在调用Web服务时获取完整的日志记录消息。 当客户端使用SOAP Web服务时,一切都井然有序。 当客户端调用REST Web服务时,会发生异常,并且响应是运行时错误。

除了为每个服务制作调解员而不是全局服务之外,我能做些什么吗?

这是调解员定义

<sequence xmlns="http://ws.apache.org/ns/synapse" name="WSO2AM--Ext--Out">
<log level="full">
    <property name="ParentID:" expression="get-property('parentID')"/>
    <property name="ActualRemoteAddress:" expression="get-property('client')"/>
    <property name="AuthHeader:" expression="get-property('AuthHeader')"/>
</log>

这是异常的开始

    ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,11]
Message: Not in an object
    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.synapse.commons.json.JsonUtil.toXml(JsonUtil.java:278)
    at org.apache.synapse.commons.json.JsonBuilder.processDocument(JsonBuilder.java:35)
    at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:138)
    at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:135)
    at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:100)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:155)
    at org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler.mediate(APIManagerExtensionHandler.java:56)
    at org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler.handleResponse(APIManagerExtensionHandler.java:85)
    at org.apache.synapse.rest.API.process(API.java:320)
    at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:86)
    at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:52)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:295)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:529)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:251)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,11]
Message: Not in an object
    at org.apache.synapse.commons.staxon.core.base.AbstractXMLStreamReader.hasNext(AbstractXMLStreamReader.java:449)
    at org.apache.synapse.commons.staxon.core.base.AbstractXMLStreamReader.next(AbstractXMLStreamReader.java:456)
    at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:88)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
    ... 25 more

1 个答案:

答案 0 :(得分:0)

当您使用内容感知中介(例如,logmediator)时,网关会将有效负载构建为soap格式。这是通过axis2.xml中定义的messagebuilders完成的。根据有效负载的内容类型,将选择正确的messagebuilder。

在您的有线日志中,网关从后端获取带有content-type -application / json的有效负载。但有效负载(&#34; Hello,me&#34;)不是实际的json格式。因此,与之相关的构建器无法解析有效负载

Deal, DealAttribute, DealAttributeOption