Hi Kent,
You need to create a StreamWriter from the WebRequest and a StreamReader
from the XML file. Then in a loop you can read from the StreamReader and
write to the StreamWriter.
Here's some sample code to illustrate
Dim Reader As System.IO.BinaryReader
Dim Writer As System.IO.BinaryWriter
Dim LocalFileStream As System.IO.FileStream
Dim Buffer(FILE_BUFFER_SIZE - 1) As Byte
LocalFileStream = System.IO.File.OpenRead("c:\MyXml.xml")
Reader = New System.IO.BinaryReader(LocalFileStream)
Writer = req.GetRequestStream
Dim ReadCount As Integer = Reader.Read(Buffer, 0,
FILE_BUFFER_SIZE)
While ReadCount > 0
Writer.Write(Buffer, 0, ReadCount)
ReadCount = Reader.Read(Buffer, 0, FILE_BUFFER_SIZE)
End While
Hope this helps,
Craig VB.Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).
--------------------
Thread-Topic: HTTP POST
thread-index: AcQmR6UMKlltTho3QleZ6/dnWpMKyw==
X-WN-Post: microsoft.public.dotnet.languages.vb
From: "=?Utf-8?B?S2VudA==?=" <
[email protected]>
References: <
[email protected]>
<
[email protected]>
Subject: RE: HTTP POST
Date: Mon, 19 Apr 2004 12:51:02 -0700
Lines: 19
Message-ID: <
[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.languages.vb
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.vb:196871
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Hi Craig,
Could you please give me an example of posting an XML file to a .asp page
using Webrequest. Here what I have so far. What is confusing me is would
you post the xml file or a stream? I have an example from the place I am
sending the XML to but their example uses MSXML 4.0 com object and I don't
quit understand how to convert to use .NET object.
Thanks again,
Kent
Dim req as Webrequest
dim rsp as webresponse
req = new Webrequest.Create(
https://SomeURL.asp)
req.method = "POST"
<Do something here to send the XML>
rsp = req.getresponse()