473,387 Members | 1,575 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,387 software developers and data experts.

Trying to serialise object as XML to Memory Stream and then send in HttpWebRequest

I have an object created called objM_message.

I want to serialize it as xml and place the xml in my
HttpWebRequest.GetRequestStream.

But the line resp = req.GetResponse
doesnt return any results .. it should do

My question is this. Is the WriteTo() method the proper one to use to
pass the contents of my memory stream into the
req.GetRequestStream

Graham

-----------------------------------------------------------
Dim memStream As New MemoryStream
serializeAPP.Serialize(memStream, objM_message)
memStream.Position = 0

Dim req As HttpWebRequest = WebRequest.Create("myURL")
Dim resp As HttpWebResponse

req.Method = "POST"
req.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"

req.ContentLength = memStream.Length
'================================================= ======
' Attempt to write XML in my XML obj to Request Stream
'================================================= ======
Try

memStream.WriteTo(req.GetRequestStream)
memStream.Flush()
memStream.Close()

Catch e1 As Exception
Console.Write("Error in request stream")
End Try
'================================================= ======
' Send down the request and get the response back
'================================================= ======
resp = req.GetResponse
-----------------------------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #1
0 1202

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

Similar topics

0
by: Steve Binney | last post by:
My code makes synchronous HttpWebRequest and HttpRebResponse calls. In VS 2003, I am getting memory leaks and event handle leaks. I am closing all streams and using "using"statements. I have...
3
by: Marc | last post by:
I am using Visual Studio 2003 with .NET Framework 1.x on XP SP2. I am executing the following code (see also http://dturini.blogspot.com/2004/06/on-past-few-days-im-dealing-with-som e.html) ...
8
by: Lee Jackson | last post by:
Whats the difference between the following in terms of how the CLR allocates and garbage collects? Which is better in terms of memory usage/performance? a) foreach (string strURL in...
7
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm...
0
by: Subra Mallampalli | last post by:
Hi, I am trying to connect over HTTPS using a client certificate. I am able to connect fine when using IE. From my application, however, I get the following error: The underlying connection...
1
by: Brian | last post by:
I'm trying to do a POST using the following code, but I'm getting a 500 error. Can somebody please help me? I'm been stuck for quite a while. private void bnInvoke_Click(object sender,...
0
by: Paul Phillips | last post by:
I have been struggling with this for a couple of weeks. I have a digital certificate installed in my certificate collection store on my local computer. The site I am trying to post to also has...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
2
by: =?Utf-8?B?UGF1bA==?= | last post by:
I am using ASP.Net 2.0 and VB.Net (although C#is ok also). I want to create an object/method/function that will take a URL as an input parameter and then return all of the HTML in that page. I...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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,...

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.