Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BizTalk Server 2013 Rest Error Handling

I'm using BizTalk Server 2013 WCF-WebHttp adapter to call REST API SalesForce. When I receive HTTP Status code different from 200, my orchestration catch the SystemException, but I still have a send port instance suspended. Is there any "native" solution to avoid send port instance suspended ? I read this post : BizTalk Server: REST Services Error Handling

But for WCF-WebHttp adapter, the CustomBinding option is not available. I tried to add fault message, but I did't find appropriate type to catch this exception yet.

Do you have any idea ?

like image 669
Larysa SUDAS Avatar asked May 02 '16 16:05

Larysa SUDAS


1 Answers

Unfortunately, no there isn't

There is an updated version of that article BizTalk Server 2013 R2: Handle exceptions from REST services in Orchestration

You have to set your send port to WCF-Custom and use the Custom binding and then re-create all the settings from WCF-WebHttp.

More details to follow.

Update:
Catching the exception in the Orchestration as a System Exception is good, you can then inspect the error to see if it is a business exception e.g. if you are doing a query to see if an object exists or not in a RESTful services before doing a create or an updated and getting a 404.

However you have to do a few more things to stop the Suspended messages on the port.

1) To stop the Suspended message on the port Enable Routing for Failed messages on the Send Port.

2) This however means it will then go to whatever framework you have for handling failed messages causing a lot of errors to be raised for business exceptions

To prevent this you either need to tweak the filter expression on your exception handler or have rules in your exception handling framework to ignore these messages.

For example we use the ESB Exception Handling Framework and we tweaked the rule to exclude that particular send port.

ESB All.Exceptions port ESB Exceptions Handling Framework All.Exceptions Port

3) However the you still need to have something else subscribe to the failed messages to make them disappear, we use a custom null-adapter for that with a filter to subscribe to the errors. This means the error only goes to the Orchestration.

NULL Adapter filter expression

NULL Adapter filter expression

like image 60
Dijkgraaf Avatar answered Oct 07 '22 19:10

Dijkgraaf