Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending an xml file

Status
Not open for further replies.

maddy41

Programmer
Dec 7, 2004
13
GB
Hi,
Can anyone tell me where to start i want to send(post) an xml file in VB.net i have done this in other languages using MSXML.4 but i dont know where to start in dot net. All examples i can find are in asp i want to send xml file from a windows dot net application.

Any help or direction would be greate thanx
Regards
Maddy
 
what do you mean by "Send"? do you want to email it? ftp it? send it over http? save it to a disk? ZModem it over a 9 pin serial connection? Create a telepathic link to an indeterminate customer and let them have it?

-Rick

----------------------
 
must be royal mail - but allow 2-3 working weeks
 
I would like to do the same as Maddy and send an XML file to an http address from a vb.net windows application. What's the best approach?

John
 
This is sorta "Ugly" but it works.. :)

'set mail server
SmtpMail.SmtpServer = "????.com"

Dim outmail As New MailMessage
outmail.To = "CodeMonkey@????.com"
outmail.Cc = "need2progm@hotmail.com"
outmail.From = "General Manager"
outmail.Subject = "Testing Mail"
outmail.BodyFormat = MailFormat.Html

Dim file As New System.IO.StreamReader("C:\XML\MyXMLDoc.xml")
Dim XMLwords As String = file.ReadToEnd()
file.Close()

outmail.Body = XMLWords
SmtpMail.Send(outmail)

Response.Redirect("Index.aspx")


Another option would be to build a string builder and look directly at your xml document

Dim x2 As String = "c:\XML\MYxml.xml"
Dim XMLReader2 As New XmlTextReader(x2)
Dim XMLData2 As New XmlDataDocument

Dim sbBody As New System.Text.StringBuilder
sbBody.Append( Whatever)


outmail.Body = sbBody.ToString
SmtpMail.Send(outmail)

Response.Redirect("Index.aspx")


Not sure any of this really helps you.. maybe it will give you a place to start looking.
 
Thanks for that, I'm finding info on this is very scarce. So as far as you know, the only way to send an xml file to an http address from a windows application is as an email? I assume then that WebResponse and WebRequest are only applicable to Web applications?
 
What do you mean by sending the file to a http address? Do you have a specific file or service that is expecting this xml file?

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
We are a recruitment company who are looking into bulk posting jobs onto a third party website. They have supplied me with the XML feed spec and the http url to post it to. I understand this is not a problem in ASP.net but what about from a VB.Net windows application?
 
What is the http url that you would be posting it to? (i.e. what file type are you posting it to?)

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
In that case I think you should be able to use the HttpWebRequest. This is just "theory" in that it isn't tested but may give you a start that you could build on:
Code:
        Dim xmlDoc As New System.XML.XmlDocument
        Dim sURL = "[URL unfurl="true"]http://recruitertest.totaljobs.com:1313/XMLDataPosting/JobLoad1.asp"[/URL]
        Dim sXML = "<?xml version='1.0' encoding='utf-8' ?><Node1><InnerNode1>test</InnerNode1></Node1>"
        Dim objRequest As System.Net.HttpWebRequest = System.Net.WebRequest.Create(sURL)
        objRequest.Method = "POST"
        objRequest.ContentLength = sXML.Length
        objRequest.ContentType = "application/x-[URL unfurl="true"]www-form-urlencoded"[/URL]
        objRequest.GetRequestStream()

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top