david wrote:
But I want to use windows application in client side as thick client (not web
client).
Right. That was assumed. Remember, the SOAP web service you are
trying to build is doing a HTTP post behind the scenes. Its
abstraction appears to be hindering you in this case rather than
helping. Thus, you are probably better off deconstructing the process.
So again, try looking at the HttpRequest object from your winform code.
Build a simple .aspx page to act as your web service and document
server. Your client HttpRequest will give you a HttpResponse that will
contain document information, a filename, and a Stream that you can use
to store the document locally. Here is a bit of code that might get
you pointed in the right direction:
HttpWebRequest webRequest = WebRequest.Create(url) as HttpWebRequest;
webRequest.Method = "GET";
HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
BinaryReader responseReader = new
BinaryReader(response.GetResponseStream());
if (response.ContentLength > -1)
{
byte[] buffer = new byte[response.ContentLength];
FileStream fs = new FileStream(fileName, FileMode.Create);
BinaryWriter writer = new BinaryWriter(fs);
long pos=0;
int count=1;
while (count > 0 && pos < response.ContentLength)
{
count = responseReader.Read(buffer, (int)pos,
(int)(response.ContentLength - pos));
writer.Write( buffer, (int)pos, count);
pos += count;
}
writer.Close();
fs.Close();
}
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/