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 web service client's frameworks handling of empty responces from web service 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 "web service client Watch "web service client New topic
Author

web service client's frameworks handling of empty responces from web service

Jim Akmer
Ranch Hand

Joined: Jul 06, 2010
Posts: 104
Hi,

I have the following generic question:
Assume I have a web service that returns as a response for one of each methods a complex type e.g. Person.
For simplicity lets assume Person has firstName (string), lastName (string), job(string), age (int) etc.
Now the xsd for Person in the associated with the web service WSDL defines all of the elements of the complex type as optional (i.e. minOccurs=0). Please do not ask why, it could happen, although for a Person, it does not make sense, it is only for a trivial example to ask my question.
Now this means that an xml in the form of <Person></Person> is valid per xsd and WSDL.
So the web service could return a response to a client that is of the form


My question is, once the web service's client framework receives this response, how would it be handled?
Taking into account that the programming model for web services is like making function calls, will the client's code get a null pointer by the framework as a response of the remote method call? It seems to me that it should return null.
Does anyone know this?

Thanks
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
The behaviour I have seen in JAXB in connection to your response would be:
- There will be a Person object.
- Any object properties, that is non-simple types, will be null.

JAXB merrily disregards any missing elements.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Jim Akmer
Ranch Hand

Joined: Jul 06, 2010
Posts: 104
@Ivan:This makes sense. What would be the response from the web service then, so that the framework (in your example JAXB) would return a null pointer to the client code? A 202 Accepted?
Jim Akmer
Ranch Hand

Joined: Jul 06, 2010
Posts: 104
Does anyone know what kind of responses from web service (including http) result in returning a null pointer in the client code of the remote method?
 
wood burning stoves
 
subject: web service client's frameworks handling of empty responces from web service