WSO2 ESB 4.9 - 发送调解器导致错误

WSO2 ESB 4.9 - Send mediator causing errors

过去几天我一直在处理一个资源(我对 WSO2 很陌生,所以我还是很慢),当我通过 SoapUI 向它提交请求时,它会记录它应该记录的所有内容直到 <send/> 中介然后转储以下错误:

ERROR -  Failed to submit the response {org.apache.synapse.transport.passthru.PassThroughHttpSender}
java.lang.NullPointerException
 at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64)
 at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462)
 at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267)
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
 at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212)
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:444)
 at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:102)
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
 at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:277)
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:679)
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:244)
 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:247)
 at org.apache.axis2.transport.base.threads.NativeWorkerPool.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)

[2015-12-10 13:11:00,508] ERROR -  Access-Control-Allow-Credentials:true,Cache-Control:no-cache,Content-Type:application/json,Etag:W/"2-mZFLkyvTelC5g8XnyQrpOw",Expires:-1,Pragma:no-cache,Vary:Origin, X-HTTP-Method-Override,Via:1.1 vegur,X-Content-Type-Options:nosniff,X-Powered-By:Express,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><jsonObject><TYPE></TYPE><NODE></NODE><STATUS>200 [OK]</STATUS></jsonObject></soapenv:Body></soapenv:Envelope> Unexpected error sending message back {org.apache.synapse.core.axis2.Axis2Sender}
org.apache.axis2.AxisFault: Failed to submit the response
 at org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:610)
 at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:269)
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
 at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212)
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:444)
 at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:102)
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
 at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:277)
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:679)
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:244)
 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:247)
 at org.apache.axis2.transport.base.threads.NativeWorkerPool.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: java.lang.NullPointerException
 at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64)
 at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462)
 at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267)
 ... 16 more

该资源接受来自 SoapUI 的 JSON 提交,如下所示:

{"tests":[{"type":"DSS","node":"2"}]}

根据该提交,它绘制了要测试的系统类型 (DSS) 以及该系统上要测试的节点 (2)。在这种情况下,它运行下面的序列,为了测试 DSS 上的节点 2,我们是 运行:

<sequence name="dss_node_2_seq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
  <log level="custom">
    <property name="[[ SQNC ]]" value="STARTING DSS2 SEQUENCE"/>
  </log>
  <call>
    <endpoint key="dss_node_2"/>
  </call>
</sequence>

这个序列显然然后调用 dss_node_2 端点,该端点目前指向一个带有一些模板化有效 JSON:

的 typicode 页面

<endpoint name="dss_node_2" xmlns="http://ws.apache.org/ns/synapse">
  <http method="post" trace="disable" uri-template="http://jsonplaceholder.typicode.com/posts/1"/>
</endpoint>

我已将资源放入 Kobra.io page 中,因此您可以查看它并进行任何必要的更改。我目前正在仅在 DSS 上对其进行测试,但有几种可能的类型,每种类型都有一定数量的节点。


如果有人能告诉我为什么它会向我抛出这些错误以及如何解决它,那将非常有帮助并且非常感谢,因为我已经坚持了几个小时,现在变得非常沮丧!

尝试将此部分移动到发送调解器之前(在您的 API 中用于向调用者发回响应)(不得在调用调解器之前定义):

<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
      <header action="remove" name="To" scope="default"/>
      <property name="RESPONSE" scope="default" type="STRING" value="true"/>
      <property action="remove" name="NO_ENTITY_BODY" scope="axis2"/>

尝试使用响应中介, 而不是

另外,在发送之前验证负载是否包含正确的 headers 写入。您可以使用

尝试使用 send Mediator 而不是调用 mediator ,这将等待整个流程完成,发送可能会帮助您发送立即响应。

 <send>
<endpoint key="dss_node_2"/>
</send>