如何向我的客户发送 wso2 esb 错误消息或异常 [英] How to send wso2 esb error message or exception to my client

查看:25
本文介绍了如何向我的客户发送 wso2 esb 错误消息或异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 wso2ESB 中引发了一个错误,以便在客户端控制一些错误,而 esb 控制台显示:

I provoke an error in wso2ESB in order to have control in the client of some errors, while the esb console displays:

ERROR {org.wso2.carbon.identity.entitlement.mediator.EntitlementMediator} -  Error occurred while evaluating the policy {org.wso2.carbon.identity.entitlement.mediator.EntitlementMediator}
org.apache.axis2.AxisFault: Access Denied. Authentication failed - Invalid credentials provided.
...
...

客户端控制台显示:

org.apache.axiom.soap.SOAPProcessingException: Transport level information does not match with SOAP Message namespace URI

我在控制台中看到不同的错误,我需要获取 esb 错误消息,以便客户端代码可以捕获相同的错误 esb

I'm seeing different errors in consoles, I need to take the esb error message so that the client code can catch the same error esb

此时我的序列故障"配置如下:

At this moment i have my sequence 'fault' configured like this:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="fault" trace="enable">
   <makefault version="soap12">
     <code xmlns:soap12Env="http://www.w3.org/2003/05/soap-envelope" value="soap12Env:Receiver"/>
     <reason xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('ERROR_MESSAGE')"/>
   </makefault>
   <send/>
</sequence>

和我的代理服务的顺序配置如下:

and a sequence in sequence to my proxy service configured like this:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="InSequence" trace="enable">
   <entitlementService remoteServiceUrl="https://localhost:9443/services/" remoteServiceUserName="srxxx" remoteServicePassword="kiytr">
      <onReject/>
      <onAccept/>
      <advice/>
      <obligations/>
   </entitlementService>
   <header xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" name="wsse:Security" action="remove"/>
   <send/>
   <drop/>
</sequence>

如果有人可以帮助我,我已经尝试了几种方法来解决我的客户端中的错误,但没有成功,我将不胜感激

I've tried several ways to get the error in my client without success if anyone can help me I would appreciate so much

推荐答案

在您的代理服务中配置一个 faultSequence,如下所示.在您的情况下,您必须在 faultSequence 中使用故障调解器.

Configure a faultSequence inside your proxy service as shown in below. In your case you have to use the fault mediator inside the faultSequence.

<faultSequence>
    <makefault version="soap12">
        <code xmlns:soap12Env="http://www.w3.org/2003/05/soap-envelope" value="soap12Env:Receiver"/>
        <reason xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('ERROR_MESSAGE')"/>
    </makefault>
    <send/>
</faultSequence>

有关向客户端发送错误消息所需的更多信息,请使用以下文档

For more information needed for sending the error message to the client use following documentations

[1] http://docs.wso2.org/wiki/display/ESB460/Error+Handling+and+Error+Codes

[2] http://docs.wso2.org/wiki/display/ESB460/故障+中介

这篇关于如何向我的客户发送 wso2 esb 错误消息或异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆