473,402 Members | 2,055 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,402 software developers and data experts.

sending xml as http post

Hi everyone,

I was wondering if anybody could help me with sending xml as part of an
http post. Any help will be greatly appreciated.
Thanks.

Nov 18 '05 #1
8 5578

what are your issues with it? what problems are you having?

"Maximus" <me@maximus.net> wrote in message
news:OM**************@TK2MSFTNGP12.phx.gbl...
Hi everyone,

I was wondering if anybody could help me with sending xml as part of an
http post. Any help will be greatly appreciated.
Thanks.

Nov 18 '05 #2

what are your issues with it? what problems are you having?

"Maximus" <me@maximus.net> wrote in message
news:OM**************@TK2MSFTNGP12.phx.gbl...
Hi everyone,

I was wondering if anybody could help me with sending xml as part of an
http post. Any help will be greatly appreciated.
Thanks.

Nov 18 '05 #3
you can user WebRequest class, and set xml data as the post data

"Maximus" <me@maximus.net> ????
news:OM**************@TK2MSFTNGP12.phx.gbl...
Hi everyone,

I was wondering if anybody could help me with sending xml as part of an
http post. Any help will be greatly appreciated.
Thanks.

Nov 18 '05 #4
you can user WebRequest class, and set xml data as the post data

"Maximus" <me@maximus.net> ????
news:OM**************@TK2MSFTNGP12.phx.gbl...
Hi everyone,

I was wondering if anybody could help me with sending xml as part of an
http post. Any help will be greatly appreciated.
Thanks.

Nov 18 '05 #5
Maximus wrote:
Hi everyone,

I was wondering if anybody could help me with sending xml as part of
an http post. Any help will be greatly appreciated.


This sample method shows how to post an XML string "xml" to a web
application located at "url".

public void PostXml(string url, string xml) {
byte[] bytes = Encoding.UTF8.GetBytes(xml);
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
request.Method = "POST";
request.ContentLength = bytes.Length;
request.ContentType = "text/xml";
using (Stream requestStream = request.GetRequestStream()) {
requestStream.Write(bytes, 0, bytes.Length);
}

HttpWebResponse response = (HttpWebResponse) request.GetResponse();
if (response.StatusCode != HttpStatusCode.OK) {
string message = String.Format("POST failed. Received HTTP {0}",
response.StatusCode);
throw new ApplicationException(message);
}
}

Cheers,

--
Joerg Jooss
jo*********@gmx.net

Nov 18 '05 #6
Maximus wrote:
Hi everyone,

I was wondering if anybody could help me with sending xml as part of
an http post. Any help will be greatly appreciated.


This sample method shows how to post an XML string "xml" to a web
application located at "url".

public void PostXml(string url, string xml) {
byte[] bytes = Encoding.UTF8.GetBytes(xml);
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
request.Method = "POST";
request.ContentLength = bytes.Length;
request.ContentType = "text/xml";
using (Stream requestStream = request.GetRequestStream()) {
requestStream.Write(bytes, 0, bytes.Length);
}

HttpWebResponse response = (HttpWebResponse) request.GetResponse();
if (response.StatusCode != HttpStatusCode.OK) {
string message = String.Format("POST failed. Received HTTP {0}",
response.StatusCode);
throw new ApplicationException(message);
}
}

Cheers,

--
Joerg Jooss
jo*********@gmx.net

Nov 18 '05 #7
les
I'm trying to do the same thing in vb.net.

Is there an equivalent vb.net example?

Thanks
Leslie

On Sun, 11 Apr 2004 11:27:55 +0200, "Joerg Jooss"
<jo*********@gmx.net> wrote:
Maximus wrote:
Hi everyone,

I was wondering if anybody could help me with sending xml as part of
an http post. Any help will be greatly appreciated.


This sample method shows how to post an XML string "xml" to a web
application located at "url".

public void PostXml(string url, string xml) {
byte[] bytes = Encoding.UTF8.GetBytes(xml);
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
request.Method = "POST";
request.ContentLength = bytes.Length;
request.ContentType = "text/xml";
using (Stream requestStream = request.GetRequestStream()) {
requestStream.Write(bytes, 0, bytes.Length);
}

HttpWebResponse response = (HttpWebResponse) request.GetResponse();
if (response.StatusCode != HttpStatusCode.OK) {
string message = String.Format("POST failed. Received HTTP {0}",
response.StatusCode);
throw new ApplicationException(message);
}
}

Cheers,


Nov 18 '05 #8
les
I'm trying to do the same thing in vb.net.

Is there an equivalent vb.net example?

Thanks
Leslie

On Sun, 11 Apr 2004 11:27:55 +0200, "Joerg Jooss"
<jo*********@gmx.net> wrote:
Maximus wrote:
Hi everyone,

I was wondering if anybody could help me with sending xml as part of
an http post. Any help will be greatly appreciated.


This sample method shows how to post an XML string "xml" to a web
application located at "url".

public void PostXml(string url, string xml) {
byte[] bytes = Encoding.UTF8.GetBytes(xml);
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
request.Method = "POST";
request.ContentLength = bytes.Length;
request.ContentType = "text/xml";
using (Stream requestStream = request.GetRequestStream()) {
requestStream.Write(bytes, 0, bytes.Length);
}

HttpWebResponse response = (HttpWebResponse) request.GetResponse();
if (response.StatusCode != HttpStatusCode.OK) {
string message = String.Format("POST failed. Received HTTP {0}",
response.StatusCode);
throw new ApplicationException(message);
}
}

Cheers,


Nov 18 '05 #9

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

Similar topics

2
by: yawnmoth | last post by:
i'm trying to send an http post request and see if the server got it correctly. i'm sending the http post request with this script: <? $address = 'domain.tld'; $port = 80; $proxy =...
3
by: Jared | last post by:
Hello people, I've had major difficulties finding the right Java technology that can be used to make an e-mail applet program. I'm trying to build an applet that would be similar, but much...
20
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
4
by: Maximus | last post by:
Hi everyone, I was wondering if anybody could help me with sending xml as part of an http post. Any help will be greatly appreciated. Thanks.
7
by: Lau | last post by:
I need to send 1000 emails from an asp.net website. Normally I would use System.Web.Mail.MailMessage() to send thru an SMTP server. But the large amount of emails results in a timeout. My server...
5
by: Vishal | last post by:
Hello, I already asked this question in the ASP.NET forums, but no help came. So I am hoping that somebody can help me out. This is really very URGENT me. For my e-commerce application, I...
3
by: Sydney | last post by:
Hi, I am trying to construct a WSE 2.0 security SOAP request in VBScript on an HTML page to send off to a webservice. I think I've almost got it but I'm having an issue generating the nonce...
0
by: sanjaygupta11 | last post by:
I am using httpwebrequest and httpwebresponse objects for sending data to remote appication by post and receiving the response from there. I am using this code in my windows application which will...
2
by: jabdulius | last post by:
Hi all, I'm trying to send a page using Perl via the WCTP protocol. For some reason, I cannot connect to the host "wctp.att.net/WCTP" (or any host for that matter). I figure it must be some...
10
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area>...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.