Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

returning multiple values in a web service

 
Nelo Angelo
Ranch Hand
Posts: 44
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

result.jpg
[Thumbnail for result.jpg]
 
Santhosh ayiappan
Ranch Hand
Posts: 80
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to construct a XML with all the user details and return the xml as String to the caller.
 
Nelo Angelo
Ranch Hand
Posts: 44
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 80
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 165
Hibernate Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic