File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Receiving Empty Response for my Java Web Service using a Complex Return type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Receiving Empty Response for my Java Web Service using a Complex Return type" Watch "Receiving Empty Response for my Java Web Service using a Complex Return type" New topic
Author

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

Doyle Reece
Greenhorn

Joined: Jan 03, 2014
Posts: 3
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

Joined: Mar 22, 2000
Posts: 12803
    
    5
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

Joined: Jan 03, 2014
Posts: 3
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

Joined: Jul 04, 2006
Posts: 235
There is a nice video tutorial. Please check that.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
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

Joined: Jan 03, 2014
Posts: 3
The Client is SOAPUI,

Person is as follows:




Thanks Bill
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Receiving Empty Response for my Java Web Service using a Complex Return type