Thanks Dan. It indeed helped.

On Wed, Mar 16, 2011 at 12:30 AM, Daniel Kulp <[email protected]> wrote:

> On Tuesday 15 March 2011 11:10:16 AM Raj Floyd wrote:
> > Hi Dan,
> >
> > Thanks for the reply. But still need to understand this. I am a novice in
> > Web service and researching on various Web service use cases. The obvious
> > and basic ones are consuming the service with the code first and contract
> > first approach. Coming to your reply:
> >
> > 1. I can use the generated client and server code (and they do not use
> > ObjectFactory or XXResponse classes) and comfortably run my services. Now
> > as you said the ObjectFactory is checked by JAXB for xsd:any type. What
> > situation makes use of this scenario?
>
> If you have a sequence or something in your schema that has an <xsd:any/>
> or
> <xsd:any maxOccurs="unbounded"/> or similar, the code that is generated for
> that would be an Object or List<Object>.     At parse time, when jaxb gets
> to
> that point in the incoming XML, it will take the incoming element name and
> check the information on the ObjectFactory to determine the class and such
> to
> unparse.    If it can find the right information, it will parse to the
> right
> JAXB class.   If the ObjectFactory isn't there or if there isn't a matching
> element name, it just parsed to a DOM and that is placed in the list.
>
>
> > 2. XX and XXResponse are used as wrappers @ runtime. It happens when?
>
> Within CXF  in the WrapperClassIn/OutInterceptors.     Without the
> wrappers,
> we need to call into JAXB for each param and for each return.   That
> involves
> a little extra overhead.  Also, if the param has some of the JAXB
> annotations
> on it directly, we have to delve into JAXB proprietary API's for those to
> work, and in some cases, that doesn't even work.    With the wrappers, the
> JAXB annotaions are on the fields properly and such so we can make a single
> call to JAXB and it pretty much "just works".
>
> Hope that helps!
> Dan
>
>
> > I am sorry for the above questions, it may sound trivial, but need to
> > understand the flow. Any pointers will be greatly appreciated.
> >
> > Thx
> >
> > Raj
> >
> > On Tue, Mar 15, 2011 at 7:18 PM, Daniel Kulp <[email protected]> wrote:
> > > On Tuesday 15 March 2011 8:27:40 AM Raj Floyd wrote:
> > > > Hi,
> > > >
> > > > When I use wsdl2java with either client or server option, it
> generates
> > > > ObjectFactory class,
> > >
> > > JAXB itself uses that.  In cases where there are xsd:any and similar or
> > > places
> > > where a JAXBElement is needed, it checks the ObjectFactory for the
> right
> > > methods for dealing with the actual elements.
> > >
> > > > XX and XXResponse classes. Why are these classes
> > > > generated and where it could be useful?
> > >
> > > When available, they are used at runtime.  The parameters (and returns)
> > > are wrappered with these objects and fed into JAXB as one whole unit
> > > instead of for each param.
> > >
> > > --
> > > Daniel Kulp
> > > [email protected]
> > > http://dankulp.com/blog
> > > Talend - http://www.talend.com
>
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog
> Talend - http://www.talend.com
>

Reply via email to