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

Sending serialized object through MessageQueue

I'm trying to implement sending an object through messaging, but I receive an
error stating I can't deserialize the object. Any clues as to why.

I have the following:

<Serializable()> Public Class navMessage

dim m_Category as int32
dim m_Id as string

property Category() as int32
Get
return m_Category
end get
set (byval value as int32)
m_Category = value
end set
end property
property MsgId() as string
Get
return m_Id
end get
set (byval value as string)
m_Id = value
end set
end property
end class

Note: .\NavTest queue exists
In the first application I do the following:

dim mq as MessageQueue(".\NavTest")
dim oMsg as new navMessage
oMsg.MsgId = "Test"
oMsg.Category = 100
mq.formatter = new binarymessageformatter
mq.send(oMsg)

In the second application I do the following:
dim mq as MessageQueue(".\NavTest")
dim oMsg as navMessage
oMsg = CType(mq.receive().body, navMessage) **
** this line give me the following error:

Cannot deserialize the message passed as an argument. Cannot recognize the
serialization format.
Jul 21 '05 #1
2 9298
Have you tried setting the Formatter to a BinaryFormatter on the receiving
message queue?

HTH
Dan

"Chuck Marques" wrote:
I'm trying to implement sending an object through messaging, but I receive an
error stating I can't deserialize the object. Any clues as to why.

I have the following:

<Serializable()> Public Class navMessage

dim m_Category as int32
dim m_Id as string

property Category() as int32
Get
return m_Category
end get
set (byval value as int32)
m_Category = value
end set
end property
property MsgId() as string
Get
return m_Id
end get
set (byval value as string)
m_Id = value
end set
end property
end class

Note: .\NavTest queue exists
In the first application I do the following:

dim mq as MessageQueue(".\NavTest")
dim oMsg as new navMessage
oMsg.MsgId = "Test"
oMsg.Category = 100
mq.formatter = new binarymessageformatter
mq.send(oMsg)

In the second application I do the following:
dim mq as MessageQueue(".\NavTest")
dim oMsg as navMessage
oMsg = CType(mq.receive().body, navMessage) **
** this line give me the following error:

Cannot deserialize the message passed as an argument. Cannot recognize the
serialization format.

Jul 21 '05 #2
Dan,

I forgot to that line of code, but yes, I had set the receiving formatter.

I have gotten it to work.

Instead of :

mq.formatter = new binarymessageformatter

I'm doing:

mq.formatter = new xmlmessageformatter(new type() {gettype(Nav.navMessage)})

on both the sending and receiving end.

Now, once I receive the message, I can do:

dim msg as Message
msg = mq.receive()

then:

msg.body.msgid

or:

dim oMsg as navMessage
oMsg = msg.body
oMsg.msgid

Thanks

"Dan Kelley" wrote:
Have you tried setting the Formatter to a BinaryFormatter on the receiving
message queue?

HTH
Dan

"Chuck Marques" wrote:
I'm trying to implement sending an object through messaging, but I receive an
error stating I can't deserialize the object. Any clues as to why.

I have the following:

<Serializable()> Public Class navMessage

dim m_Category as int32
dim m_Id as string

property Category() as int32
Get
return m_Category
end get
set (byval value as int32)
m_Category = value
end set
end property
property MsgId() as string
Get
return m_Id
end get
set (byval value as string)
m_Id = value
end set
end property
end class

Note: .\NavTest queue exists
In the first application I do the following:

dim mq as MessageQueue(".\NavTest")
dim oMsg as new navMessage
oMsg.MsgId = "Test"
oMsg.Category = 100
mq.formatter = new binarymessageformatter
mq.send(oMsg)

In the second application I do the following:
dim mq as MessageQueue(".\NavTest")
dim oMsg as navMessage
oMsg = CType(mq.receive().body, navMessage) **
** this line give me the following error:

Cannot deserialize the message passed as an argument. Cannot recognize the
serialization format.

Jul 21 '05 #3

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

Similar topics

2
by: Gabriel Gudenus | last post by:
Hi Group! I am just working on a client-server network application which exchanges different Message Classes. (ObjectInputStream and ObjectOutputStream) Now i also would like to send a file...
6
by: Jacek | last post by:
Hello I have to send a string between two applications a sender (VB) and receiver (VC++) on local machine. Using SendMessage I can not send a string, using messagequeue I can send a string, but...
3
by: Gerhard Swart | last post by:
Hi all. I'm writing a queue browser that reads queues from a specified machine and then display the data that's on the queue. I am using the MessageQueue Class in .Net(C#). I get the problem...
0
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) {...
0
by: Pierre | last post by:
Hi, I'm trying to select specific nodes from a XmlDocument filled with a serialized object and to insert these nodes into another XmlDocument. The object is well serialized (see below). From a...
4
by: Risen | last post by:
Hi,All, I read MSDN about MessageQueue,and then I want to write some code to test MessageQueue in Vb.Net 2003. But there are some errors in code,and I don't know which code are incorrect. Who...
2
by: Chuck Marques | last post by:
I'm trying to implement sending an object through messaging, but I receive an error stating I can't deserialize the object. Any clues as to why. I have the following: <Serializable()> Public...
9
by: Nick Gilbert | last post by:
Hi, I'm trying to create a system whereby my desktop application submits it's order to an online server using a webservice (pretty standard!). So, I added a new project to my solution to...
0
by: bharathreddy | last post by:
Before going to that i want to say few thing on serialization : Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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?
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
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,...
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...

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.