Reputation: 7894
I've got an application that uses both C# and Java and MSMQ. Technically the app is C# and MSMQ based with a need for a small Java component.
I've been using MSMQJava to serialize strings and integers from C# to Java.
Is there any library or technique out there that will allow me to serialize a C# object to a Java object?
I can keep the object very simple. Only string, double and integer values, no methods or references/pointers.
Upvotes: 2
Views: 579
Reputation: 1442
We use XStream both on Java and on .Net. It's easy to use and vary powerful.
Upvotes: 1
Reputation: 1932
You do not need any add on libraries in dotNET to serialize/deserialize to JSON or XML if you are targeting at least Framework 3.0 or newer. You can do either or both using DataContracts which are very flexible and give you complete control over both ends of the process if you need. Refer to the following Microsoft article:
http://msdn.microsoft.com/en-us/library/ms733127.aspx
Upvotes: 1
Reputation: 1459
XML. Way to go. JSON is very effective since there are plenty of google JSON libraries at your disposal in Java.
Simplisitic approach would be plain XML. LINQ to XML is very simple to understand.
Upvotes: 0
Reputation: 6588
Maybe create a c# WCF service for the cross-language communication. It can just be a pass through for your c# code. Keep it simple (basicHttp or wsHttp) and you should be able to pass whatever kinds of primitives you like and call any c# methods you'd like from Java.
Upvotes: 1