I have a orchestration which is receive a request from local rest service then send request to another remote Rest Service then if the remote service returns a response successfully with 200 HTTP code BizTalk can be able to process response message, but if HTTP response code different then 200 BizTalk could not process fault response message.
BizTalk log gives below error on event viewer.
Details:"System.Net.WebException: The remote server returned an unexpected response: (400) Bad Request.
{"errorMessage":{"message":"En az 1 adres alani gereklidir.","moreInfoURL":"http://paritus.com/kb/api-errors","status":400}}".
After this issue I add a fault operation on send port but BizTalk still could not catch a fail message. Have you got an any idea?
Actually you can't catch those kind of exception without some additional line of codes :) because when you catch this exception at the orchestration level the WCF adapter has already encapsulated it and you can't access to the error code, check this article for handling those kind of errors http://social.technet.microsoft.com/wiki/contents/articles/16625.biztalk-server-rest-services-error-handling.aspx
Yes there is an issue with the WCF-WebHttp adapter in that it does not set the Message Type context property if there is a fault and so it then does not go the the Fault type defined on the port.
The only way to catch it is in a System.Exception block.
See my blog post BizTalk 2013 R2 known bugs, issues & quirks, BUG: BIZTALK WCF-WEBHTTP ADAPTER DOES NOT SET MESSAGE TYPE ON ERROR
Update: The below is no longer true after CU 5 for BizTalk 2013 R2, it now throws an error.
Also please note that if the end systems throws a 500 status code, it is NOT thrown as an error at all and you have to check the status code yourself.
See BizTalk WCF-WebHttp adapter does not detect 500 error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With