This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
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
Register / Login


JavaRanch » Java Forums » Java » Web Services
Reply 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
Bartender

Joined: Oct 04, 2006
Posts: 2194
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?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: web service client's frameworks handling of empty responces from web service
 
Similar Threads
error while connecting to webservices
SOA - Basics
Error processing response from .NET web service
unable to connect to .Net web service using axis with java
How DO I Set XSDs in a web app for a Sax Parser?