• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Web service return complex data type vs. XML string

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to compare the advantage of a web service method returning complex type or xml string in different situations.

It looks more generic to return a xml string to represent the complex type object, but if so, what is the need to make a web service return a complex data type (i.e. a pojo, a bean). I know there must be some sort of judgment (depends on the use case) to pick either one, what is your standards to determine which approach to choose?

Thank you

-Rick
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ricky Murphy:
Trying to compare the advantage of a web service method returning complex type or xml string in different situations.



For one thing a SOAP web service always returns XML (or MIME for attachments).

The client decides what to do with that XML. Often code-generation tools are used to generate the code to un-marshal the XML to a bean (which may look nothing like the original complex type on the server) for expediency sake. However using static stubs is "static binding" which is a form of tight-coupling. Prodding the result XML with some XPath expressions to extract just the minimum amount of data required is a more loosely coupled approach (which requires more effort because it requires more manual coding). Finally the client could decide to simply keep the XML as is, especially if it uses an XML-based infrastructure, though it's likely that it would run an XSLT transformation on it to change it to a more suitable format for its domain.
 
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic