我遇到了麻煩,它處理來自WSO2 ESB(4.8.1)代理服務中REST API的純XML響應。我的outSequence顯然將API調用結果有效載荷預期成爲一個SOAP消息,它不是(純XML),在進一步處理它時會導致錯誤。我使用HTTP端點,但使用地址端點時發生相同的錯誤。我不得不使用GET作爲請求方法,因爲API不允許POX。 (這個問題似乎是類似於WSO2 ESB: log and convert response from the RDF REST service back to SOAP已經提到的但它似乎並沒有被固定在ESB 4.8.1和我'無法使用變通提到有)WSO2 ESB:WSO2 REST API調用中的XML響應未解析
這裏是我的終點:
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="Alfresco_login">
<http uri-template="http://localhost:8080/alfresco/service/api/login?u={query.param.name}&pw={query.param.password}" method="get"></http>
</endpoint>
這裏是代理:
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Alfresco_proxy"
transports="https,http">
<target endpoint="Alfresco_login">
<inSequence>
<property name="query.param.name" value="XXX"/>
<property name="query.param.password" value="XXX"/>
</inSequence>
<outSequence>
<log/>
<send/>
</outSequence>`enter code here`
</target>
<description/>
</proxy>
這是我從API得到的迴應:
<?xml version="1.0" encoding="UTF-8"?>
<ticket>TICKET_605cbf0977db895db9bbc6e5eb6d4dba75454cc4</ticket>
這我得到的錯誤,一旦我嘗試登錄響應:這裏
ERROR_EXCEPTION : org.apache.synapse.SynapseException: Error while building message
ERROR_DETAIL : org.apache.synapse.SynapseException: Error while building message at org.apache.synapse.mediators.AbstractMediator.handleException(AbstractMediator.java:313) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:70) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131) at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:268) at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488) at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.axis2.AxisFault: Error while building Passthrough stream at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:236) at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:111) at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:82) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:68) ... 11 more Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found ticket at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:252) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234) at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154) at org.apache.axiom.om.impl.AbstractOMMetaFactory.createStAXSOAPModelBuilder(AbstractOMMetaFactory.java:73) at org.apache.axiom.om.impl.AbstractOMMetaFactory.createSOAPModelBuilder(AbstractOMMetaFactory.java:79) at org.apache.axiom.om.OMXMLBuilderFactory.createSOAPModelBuilder(OMXMLBuilderFactory.java:196) at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:55) at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:118) at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:107) ... 13 more
任何人都找到了這樣的定位?