BizTalk Catch Http Response Code

I have an orchestration that receives a request from the local recreation service, and then sends the request to another remote Rest service, and then if the remote service successfully returns a response with 200 HTTP code, BizTalk can process the response message, but if the HTTP response is different code 200 BizTalk was unable to process the error message.

BizTalk log gives below error in 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}}". 

enter image description here

After this problem, I add a failure operation to the send port, but BizTalk still could not catch the error message. Do you have an idea?

+5
source share
2 answers

In fact, you cannot catch such an exception without an extra line of codes :) because when you catch this exception at the orchestration level, the WCF adapter has already encapsulated it and you cannot access the error code, check this article for processing such errors http://social.technet.microsoft.com/wiki/contents/articles/16625.biztalk-server-rest-services-error-handling.aspx

+1
source

Yes, there is a problem with the WCF-WebHttp adapter, because it does not set the context property of the message type if there is an error, and therefore it does not go over to the Fault type defined on the port.
The only way to catch it is in the System.Exception block.

See my BizTalk 2013 R2 blog for known bugs, problems and quirks , error: BIZTALK WCF-WEBHTTP ADAPTER DOES NOT SET MESSAGE TYPE ERROR

Refresh . The following shows how to no longer try to use CU 5 for BizTalk 2013 R2

Also note that if the end systems throw a 500 status code, it is NOT thrown as an error at all, and you must check the status code yourself.

See BizTalk WCF-WebHttp Adapter Does Not Detect 500 Errors

+1
source

All Articles