How to handle Endpoint warnings in wso2esb

354 Views Asked by At

I am using wso2 esb 4.8.1, I wish to handle warning of endpoints.I am trying to hit CXF services in tomcat server. If I test with wrong action (Operation/method)name or service name in tomcat. I am getting this message in SOAP.

<html>
   <body>No service was found.</body>
</html>

Where as in my wso2esb not getting logged any error and that particular endpoint failing showing this message.

[2014-11-24 16:57:57,931]  WARN - LoadbalanceEndpoint Endpoint [ServiceLEP] Detect a Failure in a child endpoint : Endpoint [EP3]

Since I don't know the CXF I wish to handle this in wso2esb How would I handle this message and send proper error response to client. Is any one able to help me. Thanks in advance.

2

There are 2 best solutions below

1
On

If you are using a mediator, the response will be available in the inSequence. You can log that response with code such as this after your mediator:

<enrich> 
    <source type="body"/> 
    <target type="property" action="child" property="response_body"/> 
</enrich> 
<log level="custom"> 
    <property name="The Response" expression="get-property('response_body')"/> 
</log> 

Please advise if that works in your scenario.

0
On

If your endpoint is suspended, then WSO2 by default initiate fault sequence, you can define your custom message in the fault sequence and then send it back to the client as you want. You can get ERROR_CODE and ERROR_MESSAGE property from WSO2 in Log or Switch mediator where u can check it. In log u can do it as following:

 <log level="full" separator="**********Fault Sequence File Processor***********">
      <property name="ErrorCode" expression="get-property('ERROR_CODE')"></property>
      <property name="ErrorMessage" expression="get-property('ERROR_MESSAGE')"></property>
      <property name="ErrorDetail" expression="get-property('ERROR_DETAIL')"></property>
      <property name="ErrrorException" expression="get-property('ERROR_EXCEPTION')"></property>
   </log>

You can make a check on ERROR_CODE property or ERROR_MESSAGE property in Switch mediator and then with the help of Payload mediator u can define your custom error message.