Send POST and then Recive XML - system.net.WebRequest

I need to be able to do this

POST /servlet/MainVCAServlet HTTP/1.0
Content-Type: text/xml
User-Agent: xLinkClient
Content-length: 544

<?xml version="1.0" standalone="no"?>
<!DOCTYPE request SYSTEM "http://xapi.covad.com/dtd/request.dtd">
<request>
<header>
<sender>
<key>
<login>YOUR LOGIN ID</login>
<password>YOUR PASSWORD</password>
</key>
</sender>
</header>
<body>
<subrequest type="serviceavailability">
<serviceavailabilityrequest>
<address>
<street1>1016 Asbury Way</street1>
<city>Mountain View</city>
<state>CA</state>
<zip>94043</zip>
</address>
</serviceavailabilityrequest>
</subrequest>
</body>
</request>

I am thinking it can be done with system.net.WebRequest
LVL 1
VartanaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
Yes, you should be able to do this.  Have you started with any code?  Do you know how to form a web request?

Bob
0
VartanaAuthor Commented:
no I dont know how to use it ?
0
Bob LearnedCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VartanaAuthor Commented:
Dim myRequest As WebRequest = WebRequest.Create("http://staging.mileg.org/testapp/form2.asp")
Dim strPost As String = "textbox=simon"
MessageBox.Show(myRequest.RequestUri.ToString)myRequest.Method = "post"
myRequest.ContentLength = strPost.Length
myRequest.ContentType = "application/x-www-form-urlencoded"
Dim mystreamwriter As New StreamWriter(myRequest.GetRequestStream)
mystreamwriter.Write(strPost)
mystreamwriter.Close()
MessageBox.Show(myRequest.RequestUri.ToString)

' Return the response.
Dim myResponse As WebResponse = myRequest.GetResponse
Dim mystream As Stream = myResponse.GetResponseStream
Dim mystreamreader As New StreamReader(mystream)
Do Until mystreamreader.Peek = -1
TextBox1.Text += (mystreamreader.ReadLine.ToString())
Loop
mystreamreader.Close()
mystream.Close()
0
Bob LearnedCommented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.