问题
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.
...
...
the client console displays:
org.apache.axiom.soap.SOAPProcessingException: Transport level information does not match with SOAP Message namespace URI
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
回答1:
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/Fault+Mediator
来源:https://stackoverflow.com/questions/15913188/how-to-send-wso2-esb-error-message-or-exception-to-my-client