472,796 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 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 9230
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.