Suppose I write a WebService in Java. And, the return type of that webservice is any Java collection say a Map<String, Object>. Now, as per the webservice definition, I can invoke this webservice from any technology code like C, Perl, C++, .net etc. Now, I am curious to know how that particular collection of Map<String, Object> will be handled by a C, C++, Perl code or any other language code where we don't have any that kind of collection available.
That right that we will be returning the text as in XML. So, we will return the map or list as text through XML but I am wondering how this XML will regenerate the data structure back on client side where we have code in C/C++.
Bear Bibeault wrote:By its very definition an HTTP response is text, so you cannot return any collection, Java, C C++ or otherwise. You must return text.
The problem is somewhat different that that. Using Java types as such is no problem, since they will automatically be mapped to XML by the SOAP framework. Using types that can not be mapped to one of the types defined XML Schema is a problem, though.
On the server side, if you create a Restful webservice (using any restful framework) and try to return a map,
the framework's runtime will convert the map into text-based json format before it travel thru http.
-Have a look at REST Jersey or Spring MVC for example.
On the client, it's easy to consume a text-baseD json format.
-Have a look at JQUERY for example or any language
2. Soap webservice:
Look at data type allowed by JAX-WS spec. See Metro implementaion for example.