This content has been marked as final. Show 5 replies
OSB service using HTTP transport will not capture HTTP 500 in an Error Handler as you already observed... I think one option would be to capture http-response-code from the response message and treat it in a if-then node...
The http-response-code may be placed in different variables according to the way you're calling the business service (route/publish/service-callout) and may be a hit-and-miss game... I'd start with $outbound/ctx:transport/ctx:response/http:http-response-code... Let us know how you go...
Ref to the following docs...
Hope this helps...
Web service client code usually relies on the response code of underlying transport to identify a call as successful or error. You can do a Reply with Success instead of Reply with Failure if you want system 1 NOT to get the errors coming from system 2.
Reply with failure sets the HTTP response code to 500(indicating a fault/failure). Reply with Success will send back HTTP response code 200/0 indicating a successful call. Basically you can capture error returned by system 2 and return a successful response to system 1(and may be doing something for compensation or some error logging) thus making the backend errors transparent to the calling system.
We still have issue ..
1. We have tested adding Reply under 'Publish To' but that's same issue.
2. We tried adding "Reply [ With Success ]" as first steup on stage - This does not send http 500 message to caller service but that's causing issue to next step. In this way, if there are any issue between OSB to Service2, we are not able to see failure. OSB is assuming all request as Success and reply as success on first step. Which is not correct approach.
Here is my understanding of what you are trying to achieve:
System 1 calls OSB Proxy which calls System 2 via OSb Business service.
What you want is, if system 2 returns an error then you want to suppress that error and return a success to system1?
If this is what you are trying to achieve then in the Proxy service invoke the business service in the route node (or you can choose to use a service callout in a separate stage). Create a Route Node error handler (or a stage error handler if you chose to use service callout). In this error handler do any logging if you wish, and at the end of the error handler there should be a Reply with Success. This way the service will execute normally when there is no error. If there is an error in calling system2, the flow will enter the error handler from where you can construct any response you want(by replacing content of $body) and a Reply with Success will send this response as success to system1.
If however my understanding of your requirement is incorrect then please let me know what exactly you are trying to implement.