Forums Register Login

Returning complex datatypes in a Web Service response

+Pie Number of slices to send: Send
Guys,

I have a Web Service that fetches some data from the database as an ArrayList of ObjectX where ObjectX has fields that holds the data read from the database. How should the response be such that it is easily interpretable by any client (.NET or any client as a mater of fact). In the end they are simply XML response but I would like to find out an easy way of representing this List of ObjectX. Any suggestions?
+Pie Number of slices to send: Send
 

Joe Harry wrote:Guys,

I have a Web Service that fetches some data from the database as an ArrayList of ObjectX where ObjectX has fields that holds the data read from the database. How should the response be such that it is easily interpretable by any client (.NET or any client as a mater of fact). In the end they are simply XML response but I would like to find out an easy way of representing this List of ObjectX. Any suggestions?



Hi Joe,

In order to ensure interoperability Sun and Microsoft involved in WSIT/WCF projects. If you look into WSIT, documentation, you will understand how the mapping goes between Java and .Net world.
+Pie Number of slices to send: Send
I was looking more in terms of complex object representations rather than the specifications laid out by WSIT. Anyways thanks for the pointer.
+Pie Number of slices to send: Send
One of the benefits of WS is their cross-platform and cross-language compatibility, so transferring Java-specific data types is not a good idea. Use arrays instead of Collections, and make sure that all objects (including nested ones) follow JavaBean conventions.
+Pie Number of slices to send: Send
Yes, but arrays of what type?

I was also thinking of a comma seperated String.
+Pie Number of slices to send: Send
Arrays of objects that follow JavaBean conventions. If you implement it that way, the WSDL of the service should show nicely cross-platform compatible XSD types.
+Pie Number of slices to send: Send
So I have something like this in place for the response part:



I assume that for the client it will represent some structure like this (assuming a java client)




I do now know how a .NET client would interpret this response. Does this hold good atleast for the java clients?
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3624 times.
Similar Threads
How to pass data from servlet to web services
Can WebService response be HTTP?
Generic WebService Client
How to do Bulk data transfer using Web Service
Do I need a separate Web Client?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:06:24.