With web services, data is commonly passed in XML or JSON (http://en.wikipedia.org/wiki/Json) format in order to facilitate interoperability.
When using JAX-WS or JAX-RS tools, objects that are to be passed between clients and server are marshaled to XML, using for instance JAXB, or to JSON, using for instance Jackson, and later unmarshaled to Java objects. Commonly, marshaling and unmarshaling are hidden from the developer (but it depends on the development environment etc).
Interoperability is one of the main arguments for using web services. If you do not have any requirements in that area, you may also consider using, for instance, RMI, which will allow you to use plain serialization to pass data between client(s) and server.
Thanks. I have the matrix in txt file in that format:
value value ...
Could you give me an example how to pack it into XML format? And then, how can I invoke web service's method with that matrix as an argument? I will be really grateful for help.
PS what do you mean by interoperability?
Joined: Oct 04, 2006
First of all, interoperability is the ability for, for instance, a web service implemented in Java is able to communicate with a client written in another language, like .NET.
Despite using XML (for SOAP web services), interoperability is not guaranteed.
Second, here is how to represent a map using XML; first the XML schema:
The XML schema includes an uniqueness constraint on the key in a key-value list.
Finally, an example of what an XML document adhering to the above schema may look like:
If you are doing WSDl-first development, then you just paste the XML schema from my posting into your WSDL and use the data type appropriately.
If you are doing Java-first development, then you can use the JAXB schema compiler XJC to generate Java classes corresponding to the schema.
When generating Java classes with XJC, you will loose the uniqueness constraint specified in the XML schema.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com