Hi Jervis,

Comments inline...

On 12/13/06, Liu, Jervis <[EMAIL PROTECTED]> wrote:

Hi, I am trying to understand how the code first approach works on a
client side. Presumably what the code first implies on a client side is that
we can not do any code generation from WSDL, and users shall already have an
object model in place.  What I mean by the object model is the user defined
types, such as Person, Address etc. It can be written manually in POJO or
can be generated previously from JAXB, xmlbean etc. So my question is how
user defined types are supported, more precisely, how code first works under
following scenarios:

A. Code first client with an object model written in JAXB: In order to do
the marshal/unmarshal for user defined types, we can either provide the JAXB
context with the location of these type classes or provide JAXB with the
schema file. In the latter case, the schema file can be the WSDL published
on the server side.


Currently JAXB types are loaded from the service model. See
JAXBContextInitializer. We basically loop over every MessagePartInfo and add
the class to the context. If its a List, we change it to any array type.

I'm not sure what you mean by providing JAXB with a schema file... can you
explain?

B. Code  first client with an object model written in xmlbean or other data
bindings: This should be same as JAXB case, so it should work (CXF needs to
support multiple data bindings both in tooling and runtime though).


Databindings are initialized in Databinding.initialize(). In the JAXB case
(both server and client), the context is set up via the
JAXBContextInitializer. Then the service model is updated with JAXB info (
i.e. MessagePartInfo.typeName/elementName) with the
JAXBServiceModelInitializer.

C. Code  first client with user defined types written in POJO: I don't think
this works, right? At least our current javatowsdl tool does not work with
user defined POJO types.


This works fine with the servicemodel. It uses the same process as the
above...

BTW, why JAXB does not support List by default? I read the JAXB spec, it
says the java.util.List must be supported. Is this a JAXB implementation
issue?

No idea... I'm just telling you what Koshuke (JAXB author) told me...

Cheers,
- Dan
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Reply via email to