views:

464

answers:

1

Hello, I'm trying to utilize a web service through C#. In the web service documentation it states that the web service only accepts requests as a single packet/stream and not multiple packets.

Does anyone know how to change this setting when accessing the web service through a web reference in Visual Studio?

I am getting a SOAPException "Unable to parse the incoming request" error when I send a request and I assume this is why.

Thanks for your help!

-Steve

A: 

This won't be trivial, but it won't be too difficult, either (assuming you've correctly identified the problem). See Ways to Customize your ASMX Client Proxy. In the "Heavy Duty Customization" section, you'll see how to override the GetWebRequest method of your proxy class by using a partial class. Assuming that your web reference name is "Service1Proxy":

public partial class Service1Proxy 
{
    protected override WebRequest GetWebRequest(Uri uri)
    {
        HttpWebRequest request = (HttpWebRequest) base.GetWebRequest(uri);
        request.SendChunked = false;
        return request;
    }
}

I recommend you try this, but I also recommend you set a breakpoint after the call to the base GetWebRequest method. Check to see if the original request had the SendChunked flag set or cleared.

John Saunders