How to terminate or skip SOAP response HTTP message to called server.
Hi - we have an issue with OSB project and trying to fix that.
System1 is sending SOAP message to System 2 using our OSB service. Since we have some issue between OSB and System2(we are getting HTTP 500 response code from system 2), which is causing issue with System 1.
System 1 -> OSB - System 2
For some reason, System1 look for failure between OSB and System2 as HTTP 500 message and start retrying the flow, which we really dont want.
I dont want to send HTTP 500 message to System1 ( as interface between System 1 and OSB is working, we have issue at next leg).
We have tried setting up error handler on Route/pipeline/service level but no luck. at route level, we did raise error an reply with failure option too.
Could someone pls try to help on this.
Also I have a question..
Do we have an option like "Terminate" osb instance ..? I know this case be done with BPEL but dont see any option with OSB. Please advice.
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...
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.
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.
Hi Abhishek -
Thanks for a lot for all your effort and suggestion. Yes you got my issue correctly and your provided solution worked perfectly.
We have accomplished the same with Stage error handler. No need to add route node also.