• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

returning multiple values in a web service

 
Ranch Hand
Posts: 44
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Ranch Hand
Posts: 81
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 81
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 171
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic