Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Receiving Empty Response for my Java Web Service using a Complex Return type

 
Doyle Reece
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Experts,

I am pretty new to Web Service Development / Java in General and have run into an issue. Hopefully you will get me back on track .

I am currently developing a Web Service in Eclipse using the bottom up approach. This is supposed to be something simple that I'm playing with for a small POC.

My issue is that I am receiving an empty response from my service when i return an Object ( i.e. Person ). If I switch it around to return a String, it seems to be working as expected.

Here is my SOAP UI Request:



Here is my SOAPUI Response:



I have attached my Eclipse Project for reference,

Thanks in advance for your help,

Doyle
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a good idea to try to return a Java object in a web service, it greatly restricts your possible clients.

The whole idea behind web services is to separate the utility of the service from the language of implementation - thats why universal formats like XML and JSON are so widely used.

Bill
 
Doyle Reece
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Bill,
Thanks for your response, it is greatly appreciated.

My goal is to return the contents of the 'Person' Object, I'm not sure how to do this exactly. I was assuming the object would somehow be converted into the soap response format, but not exactly sure how to achieve this.

thanks again Bill,

Doyle
 
Surendra Kumar
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a nice video tutorial. Please check that.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the client for this web service? Also, how complex is Person?

If it is a dynamic web page then JSON is indicated because it cooperates with JavaScript.

If the client is a Java or other language program and Person is simple then a simple sequence of name = value lines of text will work.

Bill
 
Doyle Reece
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Client is SOAPUI,

Person is as follows:




Thanks Bill
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Client is SOAPUI,


Really? I always think of SOAPui as programmer's tool, not a client interface.

You could return a single String formatted as multiple text lines in the Properties format ie

SSN=nnnnnnnnn
FirstName=William
LastName=Brogden
etc......

I say Properties because the java.util.Properties class can read and write that simple format.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic