How can I access this error text which is from wso2dss side standard error in WSO2 ESB fault sequence ERROR_CODE?
I am getting properly but this ERROR_MESSAGE giving NU
In ESB as default the SOAP error is not recognized. It just passes it as a basic soap Message. In order to identify it as a SOAP_FAULT you should set the property
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true">
After wards it will trigger fault sequence for the incoming SOAP_FAULT. So you have to declare coming message is a SOAP_FAULT so you hace to say it is a SOAP_FAULT and force it to error sequence. This is explained in [1] a blog past my Amila.
For the second part of the question you can use payload Factory transformation. You can use following sequence.
<sequence xmlns="http://ws.apache.org/ns/synapse" name="ErrorTransformSequence">
<log level="full">
<property name="SEQUENCE" value="----------------DSS FAULT------------------"/>
</log>
<payloadFactory>
<format>
<m:errorMessage xmlns:m="http://dss.error">
<m:error>
<m:message>$1</m:message>
</m:error>
</m:errorMessage>
</format>
<args>
<arg value="/soapenv:Fault/soapenv:Reason/soapenv:Text/text()"/>
</args>
</payloadFactory>
<header name="Action" value="urn:errormsg"/>
<property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
<send>
<endpoint>
<address uri="http://localhost:9765/services/DssService.SOAP11Endpoint/"/>
</endpoint>
</send>
</sequence>
canbe pointed to any of your email client. The given xpath directly pointing to the error message of the SOAP response you have posted in your question.
And to senf the email you can use wso2 esb mail transport in [2].
[1]. http://maharachchi.blogspot.com/2012/09/now-you-can-send-soapfaults-to-fault.html.
[2]. http://wso2.org/library/knowledge-base/use-mail-transport-esb-convert-soap-message-plain-text-mail
Please use the following code as the faultSequence.
<faultSequence>
<log level="custom">
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
</log>
</faultSequence>