BizTalk Catch Http Response Code
Asked Answered
T

2

6

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}}".

enter image description here

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?

Trabzon answered 24/7, 2015 at 14:28 Comment(4)
What is in the Catch Exception Part? Do you catch a System.Exception? Or do you catch the Fault_1 .What's defined in Fault_1?Grantley
Actually i try to catch fault_1 message whis came from send port but i can not able to catch http error response. If have another idea for catching the fault message i can try your solutionTrabzon
Is this trying to use the WCF-WebHttp adapter? Yes, the error message won't go into the fault on the port as it does not set the message type on the SOAP exception it creates. A bug in my opinion, I've blogged about it in my blog. You have to catch it as a System.ExceptionCobnut
Even with the System.Exception, where I can catch the error as mentioned, I still got a suspended resumable instance related to the send port. Is it only my?Khalilahkhalin
T
1

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

Thaine answered 26/7, 2015 at 23:41 Comment(0)
C
1

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

Cobnut answered 8/9, 2016 at 4:19 Comment(1)
Could you please check out my new related question here: #49563950Cosgrave

© 2022 - 2024 — McMap. All rights reserved.