HTTPWebRequest ?????
am 16.01.2008 17:49:46 von francois
Hello,
I cannot understand how this works ...
I do :
XmlDocuement DocIn = new XmlDocument();
blah blah for DocIn.
try{
MyRequest =
(HttpWebRequest)HttpWebRequest.Create("http://myserver/myxml web/Default.aspx");
MyRequest.Method = "POST";
MyRequest.ContentType = "text/xml;";
DocIn.Save(MyRequest.GetRequestStream());
MyRequest.Timeout = 5000;
//Get Response
HttpWebResponse = (HttpWebResponse)MyRequest.GetResponse();
}
catch(E ...
And I am locked forever in GetResponse(). No exception, no timeout, just
plain dull lock.
What s wrong ?
mysever uses integrated IIS authentification. I do set any credential for
myRequest. So I am expecting at least a HTTP 401 response.
Thanks.
Re: HTTPWebRequest ?????
am 16.01.2008 17:58:36 von francois
Adding a stream.closes() added a bit.
Is there a better coding way to send an XML file ?
Thanks.
"Francois" a écrit dans le message de news:
%23ZXpn$FWIHA.4712@TK2MSFTNGP04.phx.gbl...
> Hello,
>
> I cannot understand how this works ...
>
>
> I do :
>
> XmlDocuement DocIn = new XmlDocument();
>
> blah blah for DocIn.
>
> try{
> MyRequest =
> (HttpWebRequest)HttpWebRequest.Create("http://myserver/myxml web/Default.aspx");
> MyRequest.Method = "POST";
> MyRequest.ContentType = "text/xml;";
> DocIn.Save(MyRequest.GetRequestStream());
> MyRequest.Timeout = 5000;
> //Get Response
> HttpWebResponse = (HttpWebResponse)MyRequest.GetResponse();
> }
> catch(E ...
>
> And I am locked forever in GetResponse(). No exception, no timeout, just
> plain dull lock.
>
> What s wrong ?
>
> mysever uses integrated IIS authentification. I do set any credential for
> myRequest. So I am expecting at least a HTTP 401 response.
>
> Thanks.
>
>
Re: HTTPWebRequest ?????
am 16.01.2008 20:26:01 von brucebarker
it all depends on the server you are posting to, and how the file is handled.
its common for the server to not send the response until the he request has
been completely received.
with webrequest and a post, until you close the stream, there is no way to
know when you are done send data to the server.
now with the right server you could could keep the sockets open and have
both streams going.
-- bruce (sqlwork.com)
"Francois" wrote:
> Adding a stream.closes() added a bit.
>
> Is there a better coding way to send an XML file ?
>
> Thanks.
>
>
> "Francois" a écrit dans le message de news:
> %23ZXpn$FWIHA.4712@TK2MSFTNGP04.phx.gbl...
> > Hello,
> >
> > I cannot understand how this works ...
> >
> >
> > I do :
> >
> > XmlDocuement DocIn = new XmlDocument();
> >
> > blah blah for DocIn.
> >
> > try{
> > MyRequest =
> > (HttpWebRequest)HttpWebRequest.Create("http://myserver/myxml web/Default.aspx");
> > MyRequest.Method = "POST";
> > MyRequest.ContentType = "text/xml;";
> > DocIn.Save(MyRequest.GetRequestStream());
> > MyRequest.Timeout = 5000;
> > //Get Response
> > HttpWebResponse = (HttpWebResponse)MyRequest.GetResponse();
> > }
> > catch(E ...
> >
> > And I am locked forever in GetResponse(). No exception, no timeout, just
> > plain dull lock.
> >
> > What s wrong ?
> >
> > mysever uses integrated IIS authentification. I do set any credential for
> > myRequest. So I am expecting at least a HTTP 401 response.
> >
> > Thanks.
> >
> >
>
>
>