I already have the SOAP message built as a file on the server. All I want to
do is post that XML to the Webservice URL.
Also, how would I get the returning SOAP message?
thanks,
lee
Lee Franke - 13 Oct 2005 19:22 GMT
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();