• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic