This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes returning multiple values in a web service 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 "returning multiple values in a web service" Watch "returning multiple values in a web service" New topic
Author

returning multiple values in a web service

Nelo Angelo
Ranch Hand

Joined: Jul 25, 2011
Posts: 44

I am designing a web-service using java and eclipse which returns the user details who are marked as customer in the database.


GetData.java



LoginDetailsVO.java


On running the code I get object references like these: [[Ljava.lang.Object;@4d5575, [Ljava.lang.Object;@5585dc]
How can I get valid user details in place of object references? Please advice.



[Thumbnail for result.jpg]


I love java but she hates me... :'(
Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 80

You need to construct a XML with all the user details and return the xml as String to the caller.
Nelo Angelo
Ranch Hand

Joined: Jul 25, 2011
Posts: 44

Santhosh ayiappan wrote:You need to construct a XML with all the user details and return the xml as String to the caller.


Hi Santhosh,

Thanks for the reply. Would you please provide an example so that I could gain some insight as I am very new to web-services.

Or perhaps you could provide me a link where I could learn how to handle these cases.

Thanks again.
Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 80

You can use the XML Parser as you wish (DOM/SAX) and construct a Document object.

Then parse the LoginDetailsVO object and extract the values and set them to the Document object and finally you can convert the Document object to String and return that.

This link would be a starter for you. Dom Parser

Regards
Santhosh
Anurag Verma
Ranch Hand

Joined: Mar 30, 2012
Posts: 124

i think you are getting proper result & just printing it on screen in an incorrect way. just add a toString() method to your POJO class returning the username (or something you can identify) from it. you can also add LoggingInInterceptor & LoggingOutInterceptor to see what is going out & what is coming back to the client.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: returning multiple values in a web service
 
Similar Threads
struts
Very Quick Question:EL seems to be case insensitive?
Help Me to Understand Comparisons
struts
confusing compile error