HTTP POST using web service

anything

New Member
I have been doing some Google searches and only getting partial successful on this topic. I was wondering if someone could suggest an example of doing an HTTP POST using C# to send XML to HTTP service.I have a asmx web service that extracts data from database and I save that data to XML document. Now I have to send that XML document using SOAP protocol to HTTP service.I have this part of code for connectig to service \[code\]WebRequest myReq = WebRequest.Create("https://WEB_URL"); System.Net.ServicePointManager.CertificatePolicy = new CertificatePolicyClass(); string username = "SOMETHING"; string password = "ELSE"; string usernamePassword = username + ":" + password; CredentialCache mycache = new CredentialCache(); mycache.Add(new Uri("https://WEB_URL"), "Basic", new NetworkCredential(username, password)); myReq.Credentials = mycache; myReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword))); WebResponse wr = myReq.GetResponse(); Stream receiveStream = wr.GetResponseStream(); StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8); string content = reader.ReadToEnd();\[/code\]So does anybody have a code to send XML document to http service, this part I don't know how to write, I don't know am I on the write trace, I belive it has to go somethig like this\[code\]request.Method = "POST";request.ContentType = "application/x-www-form-urlencoded";\[/code\]So plese can somebody help me! THANKS!
 
Back
Top