Serializing Java and C# objects with WOX


News: Serializing Java and C# objects with WOX

  1. Serializing Java and C# objects with WOX (16 messages)

    This announcement presents Web Objects in XML (WOX). WOX is an open-source project available at It can serialize Java and C# objects to XML and back again. One of its main features is the generation of standard XML, which aims to be language independant. This means that if we serialize a Java object to XML, we could take the generated XML to reconstruct the object back to C#; and viceversa. WOX provides a simple and robust way of serializing objects to XML. It is easy to use, and you do not have to modify your source files with any special declarations. Some of the WOX main features are listed below: * Easy to use. The Easy class provides serialization and de-serialization methods. * Simple XML. The XML generated is simple, easy to understand, and aims to be language independent. * Requires no class modifications. Classes do not require to have default constructors, getters or setters. * Field visibility. Private fields are serialized just as any other field. WOX serializes fields regardless their visibility. * Interoperability Java and C#. WOX can serialize a Java object to XML, and reconstruct the XML back to a C# object; and viceversa. * Standard XML object representation. This could potentially allow to have WOX serializers in different object-oriented programming languages. * WOX data types. The WOX mapping table specifies how primitive data types are mapped to WOX data types. * Robust to class changes. Defaults will be used for newly added fields. * Arrays. Handles arrays and multi-dimensional arrays of primitives and Objects. * Base-64. Byte arrays are base-64 encoded for efficiency. * Collection classes. Lists and Maps are provided as WOX data types. (ArrayList and HashMap in Java; ArrayList and Hashtable in C#). * Object references. Handles duplicate and circular object references with id/idref. * Class and Type. Objects of these classes are saved by their String name. * Small footprint. The woxSerializer.jar file (Java) is only 25k. The woxSerializer.dll file (C#) is only 36k. For more information about WOX, please visit its website at Any feedback welcome! Kind regards,
  2. The link from the home page to the JavaDoc is broken.

  3. I guess it is fun to do XML serialization, but for practical purposes it is a bit too expensive (slow and verbose). If you are serious about low latency, a binary protocol is a way to go. Regards, Slava Imeshev Cacheonix: Distributed Java Cache
  4. I believe XML serialization is not just fun, but another human and computer readable representation for resources/objects. I agree it is slower and more verbose than binary encoding, but it also has some advantages over binary encodings, such as universality and portability. You can also easily see the XML representation of an object in any XML-aware web browser, or even navigate to its children. For some purposes, binary encoding is well suited, but there are particular applications, where latency is not an issue, where XML representation of objects is the way to go. Regards, Carlos
  5. I believe XML serialization is not just fun, but another human and computer readable representation for resources/objects.
    Maybe it's just me, but the only human readable XML file on my machine is an Ant script :-)
    but it also has some advantages over binary encodings, such as universality and portability.
    Is this so? What happens if we rename an element or an attribute without fixing the receiving side? Slava
  6. Is this so? What happens if we rename an element or an attribute without fixing the receiving side?
    Well - an XML schema pretty much takes care of this. Combine that with XML binding - which most modern languages including C# and Java have - and you have validated XML at both ends. Neither end can send invalid XML without generating a schema error. In any case, binary serialization carries the same penalty when something changes within an object. At the end of the day, the biggest expense of XML serialization vis-a-vis binary serialization is slower transmission speeds over the wire because it is necessarily verbose. And even this can be overcome by compressing it within a standard container like GZIP which has implementations in many languages.
  7. I have just clicked on the JavaDoc link and it works for me.
  8. Odd. I still get this: An error has been encountered in accessing this page. 1. Server: 2. URL path: /WOXJavaDoc
    index.html 3. Error notes: File does not exist: /home/groups/w/wo/woxserializer/htdocs/WOXJavaDoc
    index.html 4. Error type: 404 5. Request method: GET 6. Request query string: 7. Time: 2008-07-30 14:12:40 PDT (1217452360) Reporting this problem: The problem you have encountered is with a project web site hosted by This issue should be reported to the project (not to If this is a severe or recurring/persistent problem, please do one of the following, and provide the error text (numbered 1 through 7, above): 1. Contact the project via their designated support resources. 2. Contact the project administrators of this project via email (see the upper right-hand corner of the Project Summary page for their usernames) at user-name at users dot sourceforge dot net If you are a member of the project that maintains this web content, please refer to the Site Documentation regarding the project web service for further assistance.
  9. Ok. I tried IE and it works. FF does not work for some reason.
  10. ... over native binding libraries when combined with XML Schema? Both Java and C# have quite well optimized native XML binding libraries and both support binding and validating against XML Schema. Objects exchanged between XML-RPC systems written in different languages (e.g. client in C# and server in Java) are typically business objects and it is well worth the effort defining an XML schema for language-independent data exchange. Once the schema is defined, clients can be written in any language that supports binding to XML schema.
  11. Any notable advantage over XStream?
  12. As far as I know XStream is able to serialize only Java objects. WOX can serialize Java and C# objects, where the XML representation is standard. You can serialize a Java object to XML, take the generated XML and de-serialize the object back to C#.
  13. I used to believe that this problem was solved by web services.
  14. This article was about the "Web Objects in XML (WOX)" serializer, which is used to serialize and de-serialize Java and C# objects. On the other hand, SOAP web services allow you to execute a service and get an answer back in a SOAP message. You cannot use SOAP to serialize objects to a file. Moreover you cannot really handle objects with SOAP. I think we are taking about two different things. Regards, Carlos
  15. I already know what you say, but with Web Services i can pass a serialized object between Java and C# out of the box. Not RPC based web Services, but Document style web services. It is simple and standard. Just annotate some classes using JAXB and JSR181. By the other side if what you want is to share an xml file, there are no problems, both platform has many xml serialization-deserialization mechanisms. the only thing you have to have in common is an xsd schema.
  16. Service Data Objects[ Go to top ]

    I am certainly mistaken here, but are SDO designed to accomplish the same task through different programming languages?
  17. Debug Tool[ Go to top ]

    I wish this could be implemented on the debug feature of Eclipse, so that my unit tests mock objects could have real attribute values for any situation.