You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Pete Lamborne <pe...@gmail.com> on 2013/07/02 23:47:07 UTC

Generating classes with jaxb binding, container classes not gen'd

Hi all,

I am using the maven cxf-codegen-plugin, latest version 2.7.5, to generate
classes from a wsdl that was generated by Oracle SOA.  Only classes with a
concrete definition in the provided xsd get generated.  Here's an example
from the xsd:

<s:element name="QueryLineupRequest" type="tns:QueryLineupRequestMessageType
"/>
<s:complexType name="QueryLineupRequestMessageType">
<s:sequence>
<s:element name="RequestHeader" type="tns:RequestHeaderType"/>
<s:element name="RequestBody" type="tns:LineupRequestBodyType"/>
</s:sequence>
</s:complexType>

The class QueryLineupRequestMessageType is generated, but the "container"
class QueryLineupRequest is not.  The container class is the one I need to
send in a query payload.  There are no errors mentioned with verbose
logging enabled.

The tns: prefix is self-referencing (the header points the file it's in).

I've messed with most of the cxf args to no avail.  I'm wondering if I need
to change the binding type from JAXB (I'd rather stick with JAXB if I can),
pass some XJC args, or use a custom binding file.

Any ideas?

Thanks in advance!
Pete

Re: Generating classes with jaxb binding, container classes not gen'd

Posted by Pete Lamborne <pe...@gmail.com>.
Many thanks Dan, that did it.  I had some issues getting eclipse happy with
my xjb file, finally ended up using this global bindings file:

https://code.google.com/p/security-automation-content-repository/source/browse/trunk/content-meta-model/src/main/xsd/global.xjb?r=79

My config section for the cxf codegen plugin contains these args:

                            <defaultOptions>
                                <extraargs>
                                    <extraarg>-verbose</extraarg>
                                    <extraarg>-all</extraarg>

<extraarg>-xjc-b,${basedir}/src/main/wsdl/soa/global-binding.xjb</extraarg>
                                </extraargs>
                            </defaultOptions>

And all the classes we need for convenience are generated.  Thanks much for
your help!

-Pete


On Tue, Jul 9, 2013 at 3:06 PM, Daniel Kulp <dk...@apache.org> wrote:

>
> On Jul 9, 2013, at 4:19 PM, Pete Lamborne <pe...@gmail.com> wrote:
>
> > Hi Andrei,
> >
> > Many thanks for your response (I was on vacation when you replied).  It
> > looks like your suggestion will work just fine.  However, are you aware
> of
> > any way to make jaxb generate classes for elements?  I am unable to
> locate
> > any documentation about this.  Possibly using a binding file to disable
> > wrapper-style or something like that?
>
>
> I think if you add:
>
> <jaxb:globalBinding generateElementClass=”true”/>
>
> to a binding file, it may generate a class for it.
>
> Dan
>
>
>
>
>
>
> >
> > Thanks again,
> > Pete
> >
> >
> > On Fri, Jul 5, 2013 at 7:32 AM, Andrei Shakirin <ashakirin@talend.com
> >wrote:
> >
> >> Hi Pete,
> >>
> >> It is normal JAXB behaviour. Java class will be generated for complex
> >> type, not for element.
> >> You can create element either using appropriate method from
> >> ObjectFactory.createQueryLineupRequest()
> >> or yourself using JAXBElement type:
> >> new
> JAXBElement<QueryLineupRequestMessageType>(_QueryLineupRequest_QNAME,
> >> QueryLineupRequestMessageType.class, null, value);
> >> where value is instance of QueryLineupRequestMessageType.
> >>
> >> Regards,
> >> Andrei.
> >>
> >>> -----Original Message-----
> >>> From: Pete Lamborne [mailto:pete.lamborne@gmail.com]
> >>> Sent: Dienstag, 2. Juli 2013 23:47
> >>> To: users@cxf.apache.org
> >>> Subject: Generating classes with jaxb binding, container classes not
> >> gen'd
> >>>
> >>> Hi all,
> >>>
> >>> I am using the maven cxf-codegen-plugin, latest version 2.7.5, to
> >> generate
> >>> classes from a wsdl that was generated by Oracle SOA.  Only classes
> with
> >> a
> >>> concrete definition in the provided xsd get generated.  Here's an
> example
> >>> from the xsd:
> >>>
> >>> <s:element name="QueryLineupRequest"
> >>> type="tns:QueryLineupRequestMessageType
> >>> "/>
> >>> <s:complexType name="QueryLineupRequestMessageType">
> >>> <s:sequence>
> >>> <s:element name="RequestHeader" type="tns:RequestHeaderType"/>
> >>> <s:element name="RequestBody" type="tns:LineupRequestBodyType"/>
> >>> </s:sequence>
> >>> </s:complexType>
> >>>
> >>> The class QueryLineupRequestMessageType is generated, but the
> >>> "container"
> >>> class QueryLineupRequest is not.  The container class is the one I need
> >> to
> >>> send in a query payload.  There are no errors mentioned with verbose
> >>> logging enabled.
> >>>
> >>> The tns: prefix is self-referencing (the header points the file it's
> in).
> >>>
> >>> I've messed with most of the cxf args to no avail.  I'm wondering if I
> >> need to
> >>> change the binding type from JAXB (I'd rather stick with JAXB if I
> can),
> >> pass
> >>> some XJC args, or use a custom binding file.
> >>>
> >>> Any ideas?
> >>>
> >>> Thanks in advance!
> >>> Pete
> >>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Re: Generating classes with jaxb binding, container classes not gen'd

Posted by Daniel Kulp <dk...@apache.org>.
On Jul 9, 2013, at 4:19 PM, Pete Lamborne <pe...@gmail.com> wrote:

> Hi Andrei,
> 
> Many thanks for your response (I was on vacation when you replied).  It
> looks like your suggestion will work just fine.  However, are you aware of
> any way to make jaxb generate classes for elements?  I am unable to locate
> any documentation about this.  Possibly using a binding file to disable
> wrapper-style or something like that?


I think if you add:

<jaxb:globalBinding generateElementClass=”true”/>

to a binding file, it may generate a class for it.

Dan






> 
> Thanks again,
> Pete
> 
> 
> On Fri, Jul 5, 2013 at 7:32 AM, Andrei Shakirin <as...@talend.com>wrote:
> 
>> Hi Pete,
>> 
>> It is normal JAXB behaviour. Java class will be generated for complex
>> type, not for element.
>> You can create element either using appropriate method from
>> ObjectFactory.createQueryLineupRequest()
>> or yourself using JAXBElement type:
>> new JAXBElement<QueryLineupRequestMessageType>(_QueryLineupRequest_QNAME,
>> QueryLineupRequestMessageType.class, null, value);
>> where value is instance of QueryLineupRequestMessageType.
>> 
>> Regards,
>> Andrei.
>> 
>>> -----Original Message-----
>>> From: Pete Lamborne [mailto:pete.lamborne@gmail.com]
>>> Sent: Dienstag, 2. Juli 2013 23:47
>>> To: users@cxf.apache.org
>>> Subject: Generating classes with jaxb binding, container classes not
>> gen'd
>>> 
>>> Hi all,
>>> 
>>> I am using the maven cxf-codegen-plugin, latest version 2.7.5, to
>> generate
>>> classes from a wsdl that was generated by Oracle SOA.  Only classes with
>> a
>>> concrete definition in the provided xsd get generated.  Here's an example
>>> from the xsd:
>>> 
>>> <s:element name="QueryLineupRequest"
>>> type="tns:QueryLineupRequestMessageType
>>> "/>
>>> <s:complexType name="QueryLineupRequestMessageType">
>>> <s:sequence>
>>> <s:element name="RequestHeader" type="tns:RequestHeaderType"/>
>>> <s:element name="RequestBody" type="tns:LineupRequestBodyType"/>
>>> </s:sequence>
>>> </s:complexType>
>>> 
>>> The class QueryLineupRequestMessageType is generated, but the
>>> "container"
>>> class QueryLineupRequest is not.  The container class is the one I need
>> to
>>> send in a query payload.  There are no errors mentioned with verbose
>>> logging enabled.
>>> 
>>> The tns: prefix is self-referencing (the header points the file it's in).
>>> 
>>> I've messed with most of the cxf args to no avail.  I'm wondering if I
>> need to
>>> change the binding type from JAXB (I'd rather stick with JAXB if I can),
>> pass
>>> some XJC args, or use a custom binding file.
>>> 
>>> Any ideas?
>>> 
>>> Thanks in advance!
>>> Pete
>> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: Generating classes with jaxb binding, container classes not gen'd

Posted by Pete Lamborne <pe...@gmail.com>.
Hi Andrei,

Many thanks for your response (I was on vacation when you replied).  It
looks like your suggestion will work just fine.  However, are you aware of
any way to make jaxb generate classes for elements?  I am unable to locate
any documentation about this.  Possibly using a binding file to disable
wrapper-style or something like that?

Thanks again,
Pete


On Fri, Jul 5, 2013 at 7:32 AM, Andrei Shakirin <as...@talend.com>wrote:

> Hi Pete,
>
> It is normal JAXB behaviour. Java class will be generated for complex
> type, not for element.
> You can create element either using appropriate method from
> ObjectFactory.createQueryLineupRequest()
> or yourself using JAXBElement type:
> new JAXBElement<QueryLineupRequestMessageType>(_QueryLineupRequest_QNAME,
> QueryLineupRequestMessageType.class, null, value);
> where value is instance of QueryLineupRequestMessageType.
>
> Regards,
> Andrei.
>
> > -----Original Message-----
> > From: Pete Lamborne [mailto:pete.lamborne@gmail.com]
> > Sent: Dienstag, 2. Juli 2013 23:47
> > To: users@cxf.apache.org
> > Subject: Generating classes with jaxb binding, container classes not
> gen'd
> >
> > Hi all,
> >
> > I am using the maven cxf-codegen-plugin, latest version 2.7.5, to
> generate
> > classes from a wsdl that was generated by Oracle SOA.  Only classes with
> a
> > concrete definition in the provided xsd get generated.  Here's an example
> > from the xsd:
> >
> > <s:element name="QueryLineupRequest"
> > type="tns:QueryLineupRequestMessageType
> > "/>
> > <s:complexType name="QueryLineupRequestMessageType">
> > <s:sequence>
> > <s:element name="RequestHeader" type="tns:RequestHeaderType"/>
> > <s:element name="RequestBody" type="tns:LineupRequestBodyType"/>
> > </s:sequence>
> > </s:complexType>
> >
> > The class QueryLineupRequestMessageType is generated, but the
> > "container"
> > class QueryLineupRequest is not.  The container class is the one I need
> to
> > send in a query payload.  There are no errors mentioned with verbose
> > logging enabled.
> >
> > The tns: prefix is self-referencing (the header points the file it's in).
> >
> > I've messed with most of the cxf args to no avail.  I'm wondering if I
> need to
> > change the binding type from JAXB (I'd rather stick with JAXB if I can),
> pass
> > some XJC args, or use a custom binding file.
> >
> > Any ideas?
> >
> > Thanks in advance!
> > Pete
>

RE: Generating classes with jaxb binding, container classes not gen'd

Posted by Andrei Shakirin <as...@talend.com>.
Hi Pete,

It is normal JAXB behaviour. Java class will be generated for complex type, not for element.
You can create element either using appropriate method from ObjectFactory.createQueryLineupRequest() 
or yourself using JAXBElement type:
new JAXBElement<QueryLineupRequestMessageType>(_QueryLineupRequest_QNAME, QueryLineupRequestMessageType.class, null, value);
where value is instance of QueryLineupRequestMessageType.

Regards,
Andrei.

> -----Original Message-----
> From: Pete Lamborne [mailto:pete.lamborne@gmail.com]
> Sent: Dienstag, 2. Juli 2013 23:47
> To: users@cxf.apache.org
> Subject: Generating classes with jaxb binding, container classes not gen'd
> 
> Hi all,
> 
> I am using the maven cxf-codegen-plugin, latest version 2.7.5, to generate
> classes from a wsdl that was generated by Oracle SOA.  Only classes with a
> concrete definition in the provided xsd get generated.  Here's an example
> from the xsd:
> 
> <s:element name="QueryLineupRequest"
> type="tns:QueryLineupRequestMessageType
> "/>
> <s:complexType name="QueryLineupRequestMessageType">
> <s:sequence>
> <s:element name="RequestHeader" type="tns:RequestHeaderType"/>
> <s:element name="RequestBody" type="tns:LineupRequestBodyType"/>
> </s:sequence>
> </s:complexType>
> 
> The class QueryLineupRequestMessageType is generated, but the
> "container"
> class QueryLineupRequest is not.  The container class is the one I need to
> send in a query payload.  There are no errors mentioned with verbose
> logging enabled.
> 
> The tns: prefix is self-referencing (the header points the file it's in).
> 
> I've messed with most of the cxf args to no avail.  I'm wondering if I need to
> change the binding type from JAXB (I'd rather stick with JAXB if I can), pass
> some XJC args, or use a custom binding file.
> 
> Any ideas?
> 
> Thanks in advance!
> Pete