wood burning stoves 2.0*
The moose likes Web Services and the fly likes Is it possible to retrive multiple objects at one time ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Is it possible to retrive multiple objects at one time ?" Watch "Is it possible to retrive multiple objects at one time ?" New topic
Author

Is it possible to retrive multiple objects at one time ?

Alex Parvan
Ranch Hand

Joined: Dec 10, 2009
Posts: 115
For example, i have a getUsersOnline() method on a WebService that returns the users online at that time. The User object (and xml schema) will contain the name, age and location of each user.

So, can i retreive more than one User object ? Like an array of users ? Maybe 1 user, maybe 3, maybe 10.


"Quoting yourself is stupid" - Me
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Yes, of course you can retrieve many Users.
If you do Java-first development and the return type of a method in the endpoint implementation class is String[], then the following XML complex type will be generated:

If you do WSDL-first development, then use the maxOccurs attribute, as seen above, to define an array of some type.
Best wishes!
Alex Parvan
Ranch Hand

Joined: Dec 10, 2009
Posts: 115
Great ! Thanks, i'll post here again if i'm having trouble, please check it again tomorrow or so :P
Alex Parvan
Ranch Hand

Joined: Dec 10, 2009
Posts: 115
It works, if anyone else needs this, my xsd looks like this:



And then you can use it in Java like this:



Thank you Ivan.
 
wood burning stoves
 
subject: Is it possible to retrive multiple objects at one time ?
 
Similar Threads
control the concurent users
servlets/JSP
Validation and copying
Memory Control
Project design