If you are calling a Web Service from a BizTalk Server 2004 Orchestration, you might have encountered cases where the WebServices takes too long to execute and BizTalk times out the request, and perhaps you've wondered how to instruct BizTalk to wait just a little bit longer. As it happens, this can actually be done. The secret is to set the SOAP.ClientConnectionTimeout property on the request message you send to the WebService.

However, the documentation does not quite specify what the appropriate value for this property should be. All it says is "Specifies the time-out period of waiting for a response from the server. If set to zero (0), the system will calculate the time-out based on the request message size.". So, let me clear this up for you.

The SOAP.ClientConnectionTimeout property is actually specified in milliseconds, so, for example, if you want a timeout of 200 seconds, you can do the following on a Message Assignment during message construction:


MyRequestMessage(SOAP.ClientConnectionTimeout) = 200000;

The trick here is to understand that this property esentially maps to the Timeout property of the SoapHttpClientProtocol class. This is actually quite logical once you realize that when you add a Web Reference to a BizTalk project it essentially generates a client side proxy class similar to how it works for regular .NET projects.

However, while looking around the SOAP adapter code (using good old Reflector) trying to understand this property better, I came around something somewhat surprising: You can't specify an infinite timeout like you can for regular WS proxies by setting the timeout to -1, and it appears the use of 0 to "calculate the time-out based on the request message size" is somewhat of a misnomer.

Here's the thing: If you look at the code for the Prepare() method of the Microsoft.BizTalk.Soap.SoapMessage class, you'll notice that the Timeout property of the underlying proxy class instance is only set if the SOAP.ClientConnectionTimeout property has a value greater than 0. So, if you specify -1, or 0, the value is actually ignored. The actual code is something like this:

int num1 = this.ClientConnectionTimeout;
if (num1 > 0)
{
this.SetProperty("Timeout", num1);
Interop.Diagnostics.TraceMessage(8, "Setting Timeout property to '{0}'.", num1);
}


Tomas Restrepo

Software developer located in Colombia.