activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: sending ObjectMessage between C# and Java
Date Wed, 16 Feb 2011 11:49:30 GMT
On Wed, 2011-02-16 at 11:31 +0100, Adam Kaminiecki wrote:
> Hi,
> 
> Can anybody tell me how to get body form ObjectMessage in C#  or 
> properly send from Java??
> Everything work ok for TextMessage but when I send  text message from 
> Java in ObectMessage in C# client occur an error
> 
> where IMessage m
> ((IObjectMessage) m).Body = '((IObjectMessage) m).Body' threw an 
> exception of type 'System.Runtime.Serialization.SerializationException'
> 
> System.SystemException {base} = {"input stream is not a valid binary 
> format. The content of the initial (in bytes):.......
> 
> 
> But when I send From C# it is ok.
> 

C# cannot de-serialize a java Object, it doesn't know anything about the
byte java types or how they are encoded.  You can send C# objects to C#
clients if they know about the type you are sending but that's the limit
of what you can do with ObjectMessage in C#.

If you really need to send objects then you should look into using
something like XStream to convert them to XML and then parse the XML on
the C# side.

Regards

-- 
Tim Bish
------------
FuseSource
Email: tim.bish@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/



Mime
View raw message