2014-03-07 70 views
2

我使用wso2dss创建了用于数据插入的代理服务,所以服务工作正常,我对此非常满意。不过,虽然所有的数据复制错误发生在wso2dss我需要处理它wso2esb所以我一直这个属性在wso2esb为DSS级别的错误句柄:所以它的做工精细我正在使用该50000代码我能够如何处理wso2esb和wso2dss中的端点故障

<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/> 

处理错误,而这个错误我ESB显示此消息:

[2014-03-07 11:22:40,778] INFO - LogMediator To: /services/GeoLocationInsertion, MessageID: urn:uuid:b51629e2-934e-4227-8f50-65fd9f719b8e, Direction: request, userid = -1212807836, username = sa|214057357158656, password = sa 
[2014-03-07 11:22:40,783] INFO - LogMediator To: /services/ServiceLogin, MessageID: urn:uuid:1967bde1-d820-46f9-957d-55fbb6f7ea9e, Direction: request, usercode = sa, clientid = 214057357158656 
[2014-03-07 11:22:40,833] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:24aea5ed-f4e2-4214-809b-b3101031edf7, Direction: response, faisal = true 
[2014-03-07 11:22:40,838] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:42a17360-cd04-43bc-83ef-1f53b639de11, Direction: response, kk = true 
[2014-03-07 11:22:40,853] WARN - EndpointContext Endpoint : endpoint_71f1485e740c2b97ec407fe4d3bf86929122480f208b6642 will be marked SUSPENDED as it failed 
[2014-03-07 11:22:40,853] WARN - EndpointContext Suspending endpoint : endpoint_71f1485e740c2b97ec407fe4d3bf86929122480f208b6642 - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Fri Mar 07 11:23:10 IST 2014 
[2014-03-07 11:22:40,856] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:42a17360-cd04-43bc-83ef-1f53b639de11, Direction: response, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 500000, ERROR_MESSAGE = null 
[2014-03-07 11:22:40,857] INFO - LogMediator To: , WSAction: , SOAPAction: , MessageID: urn:uuid:42a17360-cd04-43bc-83ef-1f53b639de11, Direction: response, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ResponseJSON><Body><Data><Exception>duplicate key value violates or The system is attempting to access an inactive service </Exception></Data></Body><Status>500000</Status></ResponseJSON></soapenv:Body></soapenv:Envelope> 

上面的错误消息意味着我的端点已经进入挂起模式30秒它会在主动模式下自动后。

如果有任何用户尝试同一时间,他无法插入他的正确数据,并且由于端点不可用而丢失数据。那么我们如何将终端保持在主动模式? 如果任何其他错误会来这个问题不养:

所以
[2014-03-07 11:22:40,853] WARN - EndpointContext Suspending endpoint : endpoint_71f1485e740c2b97ec407fe4d3bf86929122480f208b6642 - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Fri Mar 07 11:23:10 IST 2014 

我将如何做到这一点? 如果我删除,我无法处理DSS级消息的财产,我得到错误像这样连我的用户没有得到任何回应:

[2014-03-07 11:20:51,816] ERROR - NativeWorkerPool Uncaught exception 
java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFault 
at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.getFault(SOAPBodyImpl.java:120) 
at org.apache.synapse.util.POXUtils.convertSOAPFaultToPOX(POXUtils.java:46) 
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:91) 
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:308) 
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:92) 
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71) 
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114) 
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:232) 
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:443) 
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166) 
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) 
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:222) 
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
at java.lang.Thread.run(Thread.java:679) 

所以这30秒是如此重要,它使我的客户的数据丢失。我怎样才能避免这种端点故障?

在wso2dss实际的错误是:如果你想配置在ESB的DSS端点的暂停行为

Nested Exception:- 
org.postgresql.util.PSQLException: ERROR: column "deviceid" is of type bigint but expression is of type character varying 
    Hint: You will need to rewrite or cast the expression. 
    Position: 81 

    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105) 
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110) 
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.getReader(DSOMDataSource.java:116) 
    at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225) 
    ... 41 more 

我处理得wso2esb故障和工作的罚款也不过端点失败uncatchble

回答

0

请参阅Endpoint Error Handling文档。

如果删除FORCE_ERROR_ON_SOAP_FAULT属性,则应该仍然能够在ESB代理的输出序列中处理DSS响应中的soap故障。

0

哟可以禁用配置与您的端点此配置:

<?xml version="1.0"?> 
<endpoint> 
    <address uri="http://localhost:9000/services/SimpleStockQuoteService"> 
    <timeout> 
     <duration>30000</duration> 
     <responseAction>fault</responseAction> 
    </timeout> 
    <suspendOnFailure> 
     <errorCodes>-1</errorCodes> 
     <initialDuration>0</initialDuration> 
     <progressionFactor>1.0</progressionFactor> 
     <maximumDuration>0</maximumDuration> 
    </suspendOnFailure> 
    <markForSuspension> 
     <errorCodes>-1</errorCodes> 
    </markForSuspension> 
    </address> 
</endpoint> 
0

我想出了这个错误我自己,这是可怕的识别它,并找到一种方法,与它合作。在处理返回的soap故障时,似乎在较早版本的WSO2 ESB(我们在4.8.1版中存在此问题)中存在一个错误。

您可以看到@JorgeInfanteOsorio的答案以禁用端点挂起,但您需要解决“未捕获的例外”问题的解决方法。我发现可以从故障消息中检索参数,然后“清除”当前的有效负载,因此任何后续的调用都不会返回异常问题。

实施例:

<!-- 
    After we call a webservice on DSS or other webservice we check if the message contains a fault message 
--> 
<property xmlns:s="http://www.w3.org/2003/05/soap-envelope" 
     name="return_fault" 
     expression="/s:Envelope/s:Body/s:Fault"/> 

<filter source="boolean(get-property('return_payzen_fault'))" regex="true"> 
    <then> 
    <!-- 
     There is a fault message on the payload... 
    --> 

     <!-- 
      Retrieve the information from the fault message. How you will access it and which information you will retrieve may be different depending if the answer comes from a third part webservice or from your own DSS. 
     --> 
     <property xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" name="code" expression="/s:Envelope/s:Body/s:Fault/s:Code/s:faultcode"/> 
     <property xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" name="code" expression="/s:Envelope/s:Body/s:Fault/s:Code/s:faultstring"/> 

     <!-- 
      Clear the payload containing the fault message 
      --> 
     <payloadFactory media-type="xml"> 
      <format> 
       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
        <soapenv:Body/> 
       </soapenv:Envelope> 
      </format> 
      <args/> 
     </payloadFactory> 

     <!-- 
      Now you can proceed and process the message as usual without getting the exception. You may probably use the parameters stored in the properties at the beginning to determine which error occured and what you are going to do next. 
     --> 

    </then> 
</filter> 
<!-- 
    There is no fault message, you can proceed with the message processing here. 
-->