过去几天我一直在研究资源(我对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$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
该资源接收来自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的典型代码页:
<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>
我已将资源放入http://mywebsite.com/api/sayVoice?eventId=1,以便您可以查看并进行必要的更改。我目前正在DSS上进行测试,但有几种类型可能,每种都有一定数量的节点。
如果有人能够建议为什么它会把这些错误扔给我以及如何解决它,那将非常有用并且非常感激,因为我已经被困在这几个小时了,而且它变得非常沮丧!
答案 0 :(得分:2)
尝试使用 发送 介体而不是调用中介,这将等待整个流程完成,发送可能会帮助您立即发送响应。
obj.number = '1234567890';
obj.number = obj.number.substr(0,2) + ' ' + obj.number.substr(2,4) + ' ' + obj.number.substr(6);
答案 1 :(得分:0)
尝试在发送中介之前移动此部分(在您的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"/>
答案 2 :(得分:0)
尝试使用回复调解员,&lt; response /&gt;而不是&lt; send /&gt;
此外,验证有效负载是否包含在发送之前写入的正确标头。您可以使用&lt; log level =“full”/&gt;
执行此操作