我正在尝试此代码:
<sequence key="ssl-validation-sequence"/> <!-- returns valid json body -->
<payloadFactory media-type="json"> <!-- Resetting payload -->
<format/>
<args/>
</payloadFactory>
<property name="NO_ENTITY_BODY" value="true" scope="axis2" type="BOOLEAN"/>
<property name="FORCE_POST_PUT_NOBODY" value="true" scope="axis2" type="BOOLEAN"/>
<property name="FORCE_HTTP_CONTENT_LENGTH" value="true" scope="axis2"/>
<property name="COPY_CONTENT_LENGTH_FROM_INCOMING" value="false" scope="axis2"/>
<header name="Accept" scope="transport" value="application/json"/>
<header name="Content-Length" scope="transport" value="0"/>
<!-- call further api -->
<call>
<endpoint>
<http method="POST" uri-template="http://10.208.35.57:8280/medium/getemployees"/>
</endpoint>
</call>
/ medium / getemployees]上的其他api调用wso2ei数据库服务:
返回有效的json-body。<!-- Call data-service --> <header name="Accept" scope="transport" value="application/json"/> <call> <endpoint> <http method="GET" uri-template="http://localhost:8280/services/employee_DataService/employees"/> </endpoint> </call>
// employee_DataService / employees
在没有ssl验证的情况下,一切正常,它返回json-body,在这种情况下,仅需Accept报头即可通过数据库服务返回json负载。
但是,只要在数据服务调用之前出现任何json有效负载,那么任何数据服务调用都会失败。
错误是从wso2ei获得的:
[2020-03-30 17:25:10,533] [] ERROR - JsonStreamFormatter Error occurred while writing to application/json java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.wso2.carbon.integrator.core.json.JsonStreamFormatter.writeTo(JsonStreamFormatter.java:107) at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:626) at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:285) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:338) at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:159) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException: charsetName at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:99) at org.apache.axis2.json.gson.JsonFormatter.writeTo(JsonFormatter.java:61) ... 16 more [2020-03-30 17:25:10,543] [] ERROR - PassThroughHttpSender Failed to submit the response org.apache.axis2.AxisFault at org.wso2.carbon.integrator.core.json.JsonStreamFormatter.writeTo(JsonStreamFormatter.java:113) at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:626) at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:285) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:338) at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:159) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) [2020-03-30 17:25:10,549] [] ERROR - ServerWorker Error processing GET request for : /services/employee_DataService/employees org.apache.axis2.AxisFault: Failed to submit the response at org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:688) at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:287) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:338) at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:159) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.axis2.AxisFault at org.wso2.carbon.integrator.core.json.JsonStreamFormatter.writeTo(JsonStreamFormatter.java:113) at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:626) at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:285) ... 10 more
回应:
<faultstring>Failed to submit the response</faultstring>
有什么解决方案可以使它正常工作吗?
谢谢。
我正在尝试此代码:
已解决!