如何拦截500 WSO2中的内部服务器错误ESB

问题描述:

我有一个端点,其错误响应必须被拦截,记录或转换。我列出了一个故障序列,并且记录了所有可能的错误。但我无法获取500内部服务器错误截获。有人可以帮助我吗?如何拦截500 WSO2中的内部服务器错误ESB

请参阅下文。

<endpoint xmlns="http://ws.apache.org/ns/synapse"> 
<address uri="https://<Hostname/WebServiceName>" format="soap11"> 
    <suspendOnFailure> 
    <progressionFactor>1.0</progressionFactor> 
    </suspendOnFailure> 
    <markForSuspension> 
    <errorCodes>500</errorCodes> 
    <retriesBeforeSuspension>0</retriesBeforeSuspension> 
    <retryDelay>0</retryDelay> 
    </markForSuspension> 
    <timeout> 
    <duration>100</duration> 
    <responseAction>fault</responseAction> 
    </timeout> 
    <enableSec policy="conf:/repository/esb/policies/Sign-UT-Policy.xml"/> 
</address> 
</endpoint> 

错误日志 TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "HTTP/1.1 500 Internal Server Error[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "Set-Cookie: CSQA9IBCOOKIE=R2172309488; path=/[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "Content-Type: application/json[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "X-Powered-By: Servlet/2.5 JSP/2.1[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "Date: Thu, 06 Nov 2014 14:21:08 GMT[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "Server: WSO2-PassThrough-HTTP[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "Transfer-Encoding: chunked[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "1f[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "{"getMyClsScheduleResponse":""}[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "0[\r][\n]" {org.apache.synapse.transport.http.wire} TID: [0] [ESB] [2014-11-06 09:21:08,790] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire}

如上所示,我看到一个500内部服务器错误在日志中,但其不会被发送到故障序列。

任何想法,将帮助..

感谢 Kranthi

我们需要使用API​​/Proxy中的以下参数将http错误代码发回故障序列。

<inSequence> 
     <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/> 
</inSequence> 

在端点超时设置的参数<responseAction>是不是你的错序列的名称,它只是提到了控制是否应该被发送到故障序列或丢弃。

<timeout> 
<duration>100</duration> 
<responseAction>fault</responseAction> 

地方有被路由在代理

<proxy xmlns="http://ws.apache.org/ns/synapse" name="StudentDashboardAcademics" transports="https http" startOnLoad="true" trace="disable"> 
     <target faultSequence="StudashFault"> 
<endpoint key="conf:/repository/esb/endpoints/CSIB_Dynamic.xml"/> 
     <inSequence> 
      <property name="Accept" expression="$trp:Accept" scope="default" type="STRING"/> 
      <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/> 
     </inSequence> 

祝大家与编码所提到的故障序列的名字......

最良好的祝愿 Kranthi

加入你的错序列代理,看看你是否能赶上我在过去几个月里学到的错误或不