Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
Scenario: You have exposed an outbound interface as a webservice in your central integration hub as enterprise webservice. A .NET application is using the webservice. Every works great during unit/integration testing. But out of the blue you are told that the webservice call to XI is failing with the following error message/stacktrace captured at the client(.NET Application)  System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at ...  Solution : To begin with it not a XI Issue it is a common myth that any error generated during calling a webservice provided by XI is associated to XI. Especially when the error messages generated are so arcane!! .The exception shown above can be resolved by altering the proxy class generated by .NET from wsdl provided for the interface.  The exception can be attributed to the KeepAlive property which determines how long before the instance is garbage collected by CLR. By default is not set to false. As a result calls to the webservice results in many active instances and eventually the webservice throws the exception.  Resolution In the Solution Explorer window(VS.NET), navigate to: Web References  Open the Reference.cs(or .vb) file and add following code in the webservice proxy class: protected override System.Net.WebRequest GetWebRequest(Uri uri) {  System.Net.HttpWebRequest webRequest =    (System.Net.HttpWebRequest) base.GetWebRequest(uri);    webRequest.KeepAlive = false;  return webRequest; } Compile you code.... This should fix the exception...
4 Comments