error handling sometimes depends on the customer for webservices and there are several scenarios, say we have the below scenario
Consumer → ESB Producer → ESB Consumer → Actual Producer
It is good to have error block in soap response message to pass the errors softly.
At ESB Consumer:
- validation errors, data errors in ESB or from the application can be handled and Error code should be assigned (better not to throw exception).
- soap faults, connection issues should be handled in ESB and ultimate consumer shall be provided with Error code either softly or by throwing exception
- In case of ESB runtime exceptions, catch them and throw exception
a. could be re-try exception if ESB consumer is not part of synchronous chain
b. if ESB Consumer is part of sync chain, then add error codes for re-try/no retry and throw exception
At ESB producer:
- validation errors, data errors in ESB or from the application can be passed to consumer in softly w/o throwing exception (with error codes)
- In case of ESB runtime exceptions, catch them, add Error code to error (or just error code) based on error
- For exceptions thrown by ESB Consumer or ESB runtime issues in ESB producer, catch them in ESB producer then we have two options in ESB Producer
a. an exception can be thrown to generate a soap fault for ultimate consumer
b. supress the errors and pass in error bloack within the response message
Apart from this it is always good to maintain list of errors that can be re-tried as in some realtime applications we do not want to re-try within ESB but inform consumer that this request can be re-tried again.
in general, always better to handle exception/errors and process as per our requirements.
#webMethods#Integration-Server-and-ESB#webMethods-General