简体   繁体   English

WSO2 ESB 4.9-发送介体导致错误

[英]WSO2 ESB 4.9 - Send mediator causing errors

I've been working on a resource over the last few days (I'm very new to WSO2 so I'm still pretty slow) and when I submit a request to it via SoapUI, it logs everything it should up to the <send/> mediator and then dumps the following errors: 最近几天我一直在处理资源(我对WSO2还是很陌生,所以我仍然很慢),当我通过SoapUI向它提交请求时,它将记录所有应该<send/><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$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) [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$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: 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 

The resource takes in a JSON submission from SoapUI, like the one below: 该资源从SoapUI接收JSON提交,如下所示:

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

From that submission, it draws the type of system to test (DSS) and which node on that system to test (2). 从该提交中,它得出要测试的系统(DSS)的类型以及该系统上要测试的节点(2)。 In this case, it runs the sequence below, in order to test node 2 on the DSS we're running: 在这种情况下,它将运行以下序列,以测试我们正在运行的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> 

This sequence obviously then calls the dss_node_2 endpoint which at the moment points to a typicode page with some templated valid JSON: 然后,此序列显然会调用dss_node_2端点,该端点目前指向带有一些模板化有效JSON的拼写代码页面:

 <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> 

I have put the resource into a Kobra.io page so you can see it and make any changes that are necessary. 我已将该资源放入Kobra.io页面,以便您可以查看并进行必要的更改。 I'm currently testing it on just DSS at the moment but there are several types that are possible, each with a set number of nodes. 目前,我目前仅在DSS上对其进行测试,但是有几种可能的类型,每种类型都有一定数量的节点。


If anyone could suggest why it's throwing these errors at me and how to fix it, that'd be really helpful and much appreciated as I've been stuck on this for hours now and it's becoming quite the frustration! 如果有人可以建议为什么将这些错误扔给我以及如何解决,那将是非常有帮助的,并且非常感激,因为我已经被这个问题困扰了几个小时了,这实在令人沮丧!

Try using send Mediator instead of call mediator ,Which will wait for the entire flow to complete, send may help you to send the response immediately. 尝试使用send Mediator而不是call mediator,它将等待整个流程完成,send可以帮助您立即发送响应。

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

Try to move this part just before send mediator (used in your API to send back a response to the caller) (it must not be defined before call mediator) : 尝试在发送中介程序之前使用此部分(在您的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"/>

Try using respond mediator, <respond/> instead of <send/> 尝试使用响应调解器<respond />而不是<send />

Also, verify the payload to contain the proper headers write before the send. 另外,在发送之前,验证有效载荷是否包含正确的标头写入。 You can do this with a <log level="full"/> 您可以使用<log level =“ full” />执行此操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM