Geeks With Blogs
Koushal Deshpande kd
I have faced the issue of calling web service from BizTalk, where intermittently either service is not available or there is some problem in connecting the service. Service can return response error code which is other than HTTP 200 code ie. HTTP 400 or HTTP 500 code. BizTalk doesnt like it. Send port will treat as warning, write warning in event viewer and retries. But eventually if problem and error persists then error will be thrown from send port. This error will be received in Orchestration. 

You can set exception handler block to catch the exception i.e. System.Exception or System.EntryPointNotFoundException. You can handle the exception gracefully. But send port instance will get suspended. This will not go away unless manually terminated. Since the exception is thrown from send port and probably it is valid response, there is no point in resuming it too. If you try doing it, orchestration which had called the service has already handled exited since exception has been handled in exception handler block.
This scenario needs to be handled by a separate orchestration which we can call "SendPortExceptionHandler". This orchestration will have only one receive shape connected to receive port. It will receive message of type Raw Xml. A filter needs to be created like below:

ErrorReport.FailureCode Exists   And
ErrorReport.MessageType == schema_namespace#root_node


You can add multiple filters, so that all exceptions at send port will be handled by single orchestration.

-----------------------------------------------------------------------------------------------------------------------------

If we get exception say System.EntryPointNotFoundException and we want to handle this manually. We might get this error if end point is not available or network is down. Then we might want to suspend the orchestration and retry manually. For doing this, we need to add a loop. Add a scope in that loop. Catch the specific exception in that scope exception handler. Please see below:


In the first expression box we will initialize values for retry. 

// Set retry to true

ServiceRetry = true;
ServiceRetryCount = 0;


In the internal scope (Mule ESB Scope) I am catching System.EntryPointNotFoundException. You can add another exception handler block to throw other errors. In this block I am setting values as below:

// Set retry to true

ServiceRetry = true;
ServiceRetryCount = ServiceRetryCount + 1;

In decide shape I am checking if retry count ServiceRetryCount <= 3 then it suspends the flow else exception will thrown. It will create a finite number of retries and orchestration will exit gracefully.
In outer all other exceptions are caught and thrown back to the calling orchestration.

This way, we can handle service end point related and web exceptions in BizTalk.


Posted on Monday, March 6, 2017 3:36 PM BizTalk , Service End Point Exception , Web Exception , HTTP400 , HTTP500 , HTTP200 , There was no endpoint listening at , System.Net.WebException , This is often caused by an incorrect address or SOAP action. See InnerException , if present , for more details. Resource not found. , System.Net.WebException: The remote server returned an unexpected response: (400) BadRequest , System.Net.WebException: The remote server returned an unexpected response: (500) BadRequest | Back to top


Comments on this post: Handling Exception in calling Web Service, In BizTalk

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
Hi! Thank you for the cool tips! I`m going to use them for my web service "college homework help online".
Left by Andrew Lowe on Mar 06, 2017 5:44 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
Good post..Zellmeonline
Left by Anu on Mar 14, 2017 10:13 AM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
Your post helped me to learn how to handle exceptions in calling web service. Since it is explained with a pictorial representation, the concept is very clear to me. If you provide its source code, then it will be very useful. modular home manufacturers
Left by Oshin on Mar 14, 2017 5:28 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
Hi Oshin,
I dont have a prototype which is working for implementation. I have used this in project. You try to implement this and let me know if you get stuck anywhere.
Left by koushal on Mar 14, 2017 7:17 PM

# BizTalk
Requesting Gravatar...
I didn't realize that people were actually still using BizTalk !
How do you like that XSLT message mapper ?
have you tried using VB to integrate CORBA or MFC ?
Left by Josh on Mar 17, 2017 8:24 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
Kotlin 1.1.2 version launched with some new features and resolves some bugs. I decided to research the upcoming changes released in past four EAP milestones and go through those that might impact Android Development.
http://www.tellmehow.co/whats-new-features-kotlin-1-1-2-version/
Left by Sawan Kumar on Jun 16, 2017 1:07 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
thank a lot for your kind information.
root explorer apk free download
Left by naeem on Jul 09, 2017 12:37 AM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
great post!! very informative and helpful
annotation annotated bibliography example
Left by sambhav on Jul 14, 2017 8:40 AM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
, I'll walk through hell with you.
geometry dash
happy wheels
Left by happywheels on Jul 17, 2017 11:39 AM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
Handling Exception in calling Web Service, In BizTalk is a serious issue that I have been confronting for few months. So I wanted to fix the issue as soon as possible. The instructions seem to be simple and I have decided to follow those instructions strictly. face mask peel off
Left by Sam on Jul 21, 2017 9:19 AM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
very great stuff. here is information about the usps certified mail return receipt cost
Left by aashi on Aug 09, 2017 11:25 AM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
keep on sharing useful information, please have a look at USPS Tracking and USPS Hold Mail as well.
Left by evan on Aug 18, 2017 1:58 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
Thanks for amazing post, this is gem :)

I like it, check my post too
Left by Kevin on Aug 31, 2017 3:29 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
This is well detailed and it helped me alot especially with my infinix hot 5 lite and infinix zero 5 which are good android phones from infinix.
Left by Maati on Sep 01, 2017 12:58 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
check the article about How to Root Samsung J7 Prime
Left by samsungroot on Oct 04, 2017 12:46 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
Thanks for the very useful tips. I will use it on my call web services documented here.
Left by Rammat on Oct 21, 2017 2:00 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
Thanks you very much. This is very useful to me. If you've got time check out the best latest phones from Samsung Samsung Galaxy S8 and Samsung Galaxy Note 8
Left by Matiks on Oct 21, 2017 2:08 PM

# re: Handling Exception in calling Web Service, In BizTalk
Requesting Gravatar...
thanks for the amazing stuff. here is complete detail of good night love poems and sweet good night poems
Left by naveen sharma on Oct 22, 2017 11:35 AM

Your comment:
 (will show your gravatar)


Copyright © Koushal Deshpande | Powered by: GeeksWithBlogs.net