Re: Send SOAP XML to Webservice URL
- From: "Lee Franke" <lee.franke@xxxxxxxxxxxxxxx>
- Date: Thu, 13 Oct 2005 13:22:58 -0500
Figured out the answer.
In case someone else needs to know:
//the URL is on the application
string strURL = this.txtURL.Text;
//go find the raw XML
this.openFileDialog1.Filter = "XML files (*.xml) | *.xml";
this.openFileDialog1.ShowDialog();
//load the XML
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(this.openFileDialog1.FileName.ToString());
//Create the Web request
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(strURL);
//set the properties
request.Method = "POST";
request.ContentType = "text/xml" ;
request.Timeout = 30 * 1000;
//open the pipe?
Stream request_stream = request.GetRequestStream();
//write the XML to the open pipe (e.g. stream)
xmlDoc.Save(request_stream);
//CLOSE THE PIPE !!! Very important or next step will time out!!!!
request_stream.Close();
//get the response from the webservice
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Stream r_stream = response.GetResponseStream();
//convert it
StreamReader response_stream = new
StreamReader(r_stream,System.Text.Encoding.GetEncoding("utf-8"));
string sOutput =response_stream.ReadToEnd();
//display it
this.txtAbstract.Text = sOutput;
MessageBox.Show(sOutput);
//clean up!
response_stream.Close();
.
- References:
- Send SOAP XML to Webservice URL
- From: Lee Franke
- Send SOAP XML to Webservice URL
- Prev by Date: WS Works Locally but not on Web Server
- Next by Date: Re: ClientCertificates and SoapWebRequest
- Previous by thread: Send SOAP XML to Webservice URL
- Next by thread: WS Works Locally but not on Web Server
- Index(es):
Relevant Pages
|