Anne Thomas Manes wrote:
...

As a general rule, it's best to avoid directly exposing
language-specific types through a web services interface, though. The
purpose of a web services interface is to enable interoperability with
other languages. Other languages don't support Java collections and
generics.

A Java generic collection is no more language-specific than an array - they're completely equivalent from the standpoint of data structure, and should be represented the same way in a corresponding schema.


 You want your interface to map easily to the XML type
system, therefore, your interface should expose simple types, beans,
and arrays. If you prefer to exploit the power of the Java type system
within your application -- fine. But use a model similar to DAO to
provide a layer of abstraction between your interface (simple, flat
structures) and your internal object model (rich graphs).

A DAO model is certainly one approach to use, and this is effectively what you get when you generate code from WSDL/schema with frameworks such as ADB or JAXB. In this case it's up to your application code to transfer data to and from the DAOs while staying consistent with the schema (since most frameworks don't enforce the schema directly - as of Axis2 1.3, ADB does a better job in this area than JAXB).

It's far from the only approach, though. JiBX bindings serve the same purpose as a DAO layer, and many users find this more convenient than writing their own transfer code.

 - Dennis

--
Dennis M. Sosnoski
SOA and Web Services in Java
Axis2 Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to