Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com
The Web Service Provider that we are using recommends NOT send Expect100Continue header.
The specifying static value
System.Net.ServicePointManager.Expect100Continue=false;
is not good, because some other providers may prefer to use the header.
In the haacked's "HttpWebRequest and the Expect: 100-continue Header Problem" post   comment of Mirronelli Jun 02, 2005 6:22 AM  suggest to specify webRequest.ServicePoint.Expect100Continue = false; for  each webRequest.

 If I am using web service(derived from SoapHttpClientProtocol) I can use ServicePointManager Class FindServicePoint method. 

Uri uri=new Uri(xws.Url);
ServicePoint servicePoint = ServicePointManager.FindServicePoint(uri);
// Debug.Assert(servicePoint.Expect100Continue == false, "Investigate why not?.");
if (servicePoint.Expect100Continue == true)
{ //should happen only once for each URL
   servicePoint.Expect100Continue =
false;

}

Posted on Tuesday, January 13, 2009 11:47 PM ASP.NET , Web Services/WCF | Back to top


Comments on this post: Specify Expect100Continue=false in Web Service client.

# re: Specify Expect100Continue=false in Web Service client.
Requesting Gravatar...
This was a serious life saver. Seriously thank you. I had been troubleshooting this for roughly 8 hours straight and couldn't find a solution and came across the comment by Mirronelli and tried that and it wasn't working. I kept getting a null exception but with this code it doesn't do that now. Thanks you again.
Left by lixid on Mar 23, 2009 2:35 AM

# re: Specify Expect100Continue=false in Web Service client.
Requesting Gravatar...
Thanks.
This was of great help.
Left by Dejan Stanic on Dec 10, 2009 6:38 AM

# re: Specify Expect100Continue=false in Web Service client.
Requesting Gravatar...
Thanks.
Great time saver.
Left by Günger Zöchbauer on Jan 06, 2010 3:11 PM

# Expect100Continue - How to Send Data Packet
Requesting Gravatar...
It's OK i am getting Expect100Continue Error, now how to send data bytes in Next Continue Packet to complete the request.

2. OK, i disabled Expect100Continue=false, but sniffer shows it sending 2 request 2 server, 1 without Post Data and 1 with Post Data, whereas 1st Request which goes without Post Data get Response Returned, however 2nd Request just gone, thought it's in correct form, but getting no response.
Left by Anil Kumar on Jun 01, 2010 4:25 AM

# re: Specify Expect100Continue=false in Web Service client.
Requesting Gravatar...
Great tip!
But, after a while my SOAP client goes back to the default value Expect100Continue=true...? Any ideas?
Left by Arne on Sep 09, 2010 4:43 AM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net