Skip to Content
Former Member
Apr 27, 2006 at 11:55 AM

Using WebServices within .NET offered by NetWeaver Server.


Hi Guys,

I had problems with using a NetWeaver WebService within .NET since I got error messages such as:

- The server committed a protocol violation. Section=ResponseStatusLine

- Unexpected network error. The connection was closed unexpectedly.

In my opinion there are two reasons for those issues: at first the HTTP 1.1 protocol implementation from NetWeaver and Microsoft seem not to be compatible. Another issue is that Microsoft seems to try to let the connection to the server open in order to reduce connection overhead.

The solution that I have found is as follows:

Just edit the .cs file that was generated according to your .wsdl file. (i.e. Reference.cs) There add the following lines in the main class:

protected override System.Net.WebRequest GetWebRequest(Uri uri)


HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest(uri);

webRequest.ProtocolVersion = HttpVersion.Version10;

webRequest.KeepAlive = false;

return webRequest;


The most important line is imho the ProtocolVersion = HttpVersion.Version10. For being on the safe side it is also adviseable to switch off the KeepAlive issue.

Perhaps one of you had the same problems and has a other/better solution. I would be glad to know it.