2014-03-07 54 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. 
-->