473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Send SOAP XML to Webservice URL

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
Nov 23 '05 #1
1 22258
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.GetEnco ding("utf-8"));
string sOutput =response_stream.ReadToEnd();

//display it
this.txtAbstract.Text = sOutput;
MessageBox.Show(sOutput);

//clean up!
response_stream.Close();
Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Oliver Hirschi | last post by:
Hi, I am really confused. I try to call a soap-method on a server with one parameter and I like to get the return-parameter of this method, but I get ever the following exception by invoking the...
5
by: mark kurten | last post by:
i have a requirement to send a soap message to a web service. i'm familiar with the soap toolkit using vb. i need to generate a xml document which i think i can do, but i don't know how to...
0
by: Hans Kesting | last post by:
Hi, I'm trying to create a client for some webservice. BUT I have only limited information: * no WSDL available ("expected Q1-06") (it seems to be written in Java) * I don't have access (yet)...
4
by: ad | last post by:
I want to send a DataSet to WebService, but the DataSet if too huge(there about 50000 records, and 50 fields every record). My solution is 1.save the DataSet as XML file, 2.zip the XML file. 3....
2
by: Cory | last post by:
I'm trying to find the best way to communicate between an IE-viewed HTML page and a .NET Web Service. The only option that seems feasible for my needs is the WebService.htc behavior provided by...
18
by: A.M | last post by:
Hi, Is there any way to call a WSS web service method by using browser and see the XML result in browser as well? I have been told that there is query string syntax for calling...
0
by: Alexiel | last post by:
Hi, i have a problem, I have a Java Client and i call my webservice on ..NET. This run perfectly just except when i send parameters don't work fine. I send my code : This is my java...
5
by: Trapulo | last post by:
Hello, I need to send to a webservice a parameter that is a string containing an XML doc. In this xml, a node value came from a byte array (it's an RSA signature). What is the best way to convert...
6
by: Peter van der veen | last post by:
Hi I have the following problem. I'm calling a webservice from within a VB.net 2005 Windows program. For this i got a WSDL file and loaded that in VB. Until now i just call the webservice and...
15
by: =?Utf-8?B?ZG91Zw==?= | last post by:
I hadn't had a class yet and I had some MS help on this to set up, but I wrote a .Net WS that creates a proxy class response using SOAP. Works fine. And in kind of a good way, the IDE has hidden...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.