You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Kessel, Christopher" <ck...@transunion.com> on 2011/05/17 21:08:13 UTC

2.3.3 WSDL generation creates duplicates (2.2.10 didn't)

I'm using 2.3.3 with a project and the wsdl creation contains duplication of the web service request/response objects. elements. I'm generating the WSDL from the annotated Java code. I have an older project using 2.2.10 and it only generates the 1st element definitions and references them where 2.3.3 is duplicating. 

Any ideas why? Here's the wsdl snippets:

<wsdl:definitions name="test_v1" targetNamespace="http://mycompany.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:tns="http://mycompany.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http:// mycompany.com" elementFormDefault="unqualified"
                   targetNamespace="http:// mycompany.com" version="1.0">
            <xs:element name="MyRequest">
                <xs:complexType>
                       ...complicated generated type stuff here...
                </xs:complexType>
            </xs:element>
            <xs:element name="MyResponse">
                <xs:complexType>
                       ...complicated generated type stuff here...
                </xs:complexType>
            </xs:element>
            <xs:element name="doSomethingExciting" type="tns:doSomethingExciting "/>
            <xs:element name=" doSomethingExcitingResponse" type="tns:doSomethingExcitingResponse"/>
            <xs:complexType name="doSomethingExciting">
                <xs:sequence>
                    <xs:element minOccurs="0" name="MyRequest">
                        <xs:complexType>
                             ...same complicated generated stuff that we had above...
                        </xs:complexType>
                    </xs:element>
                </xs:sequence>
            </xs:complexType>
            <xs:complexType name=" doSomethingExcitingResponse">
                <xs:sequence>
                    <xs:element minOccurs="0" name="MyResponse">
                        <xs:complexType>
                             ...same complicated generated stuff that we had above...
                        </xs:complexType>
                    </xs:element>
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
    </wsdl:types>
   ... wsdl type/binding/service stuff...
</wsdl:definitions>



RE: 2.3.3 WSDL generation creates duplicates (2.2.10 didn't)

Posted by "Kessel, Christopher" <ck...@transunion.com>.
After pasting that it occurred to me that the empty name in the XmlType may be the problem. And indeed it was. If I put "MyRequest" as the name for the XmlType, then it generates the schema as expected.

Thanks Daniel. As usual, it just took you pointing me in the right direction :)

Chris

-----Original Message-----
From: Kessel, Christopher [mailto:ckessel@transunion.com] 
Sent: Monday, May 23, 2011 12:56 PM
To: users@cxf.apache.org
Subject: RE: 2.3.3 WSDL generation creates duplicates (2.2.10 didn't)

It has the @XmlType annotation set, though maybe it's wrong somehow? It's what I got working before with 2.2.10 and I haven't ever changed it with the upgrade to 2.3.3.

@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "MyRequest")
@XmlType(name = "", propOrder = {} )
public class MyRequest
{
...
}

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Wednesday, May 18, 2011 1:17 PM
To: users@cxf.apache.org
Cc: Kessel, Christopher
Subject: Re: 2.3.3 WSDL generation creates duplicates (2.2.10 didn't)


Not really sure.   What annotations do you have on your "MyRequest" and 
"MyResponse" objects?    It LOOKS like you don't have an @XmlType annotation 
on them and likely only an XmlRootElement annotation.   My suggestion would be 
to have both.

Basically, the newer versions of JAXB are bit more strict about having proper 
annotations.   If a field or similar is a type that is only "allowed" to be a 
root, then it tends to copy the whole thing into the schema.   I'm not sure 
why.   However, making it be a XmlType as well would allow it to reference it 
directly.

Dan


On Tuesday, May 17, 2011 3:08:13 PM Kessel, Christopher wrote:
> I'm using 2.3.3 with a project and the wsdl creation contains duplication
> of the web service request/response objects. elements. I'm generating the
> WSDL from the annotated Java code. I have an older project using 2.2.10
> and it only generates the 1st element definitions and references them
> where 2.3.3 is duplicating.
> 
> Any ideas why? Here's the wsdl snippets:
> 
> <wsdl:definitions name="test_v1" targetNamespace="http://mycompany.com"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://mycompany.com"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <wsdl:types>
>         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:tns="http:// mycompany.com" elementFormDefault="unqualified"
> targetNamespace="http:// mycompany.com" version="1.0"> <xs:element
> name="MyRequest">
>                 <xs:complexType>
>                        ...complicated generated type stuff here...
>                 </xs:complexType>
>             </xs:element>
>             <xs:element name="MyResponse">
>                 <xs:complexType>
>                        ...complicated generated type stuff here...
>                 </xs:complexType>
>             </xs:element>
>             <xs:element name="doSomethingExciting"
> type="tns:doSomethingExciting "/> <xs:element name="
> doSomethingExcitingResponse" type="tns:doSomethingExcitingResponse"/>
> <xs:complexType name="doSomethingExciting">
>                 <xs:sequence>
>                     <xs:element minOccurs="0" name="MyRequest">
>                         <xs:complexType>
>                              ...same complicated generated stuff that we
> had above... </xs:complexType>
>                     </xs:element>
>                 </xs:sequence>
>             </xs:complexType>
>             <xs:complexType name=" doSomethingExcitingResponse">
>                 <xs:sequence>
>                     <xs:element minOccurs="0" name="MyResponse">
>                         <xs:complexType>
>                              ...same complicated generated stuff that we
> had above... </xs:complexType>
>                     </xs:element>
>                 </xs:sequence>
>             </xs:complexType>
>         </xs:schema>
>     </wsdl:types>
>    ... wsdl type/binding/service stuff...
> </wsdl:definitions>

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

RE: 2.3.3 WSDL generation creates duplicates (2.2.10 didn't)

Posted by "Kessel, Christopher" <ck...@transunion.com>.
It has the @XmlType annotation set, though maybe it's wrong somehow? It's what I got working before with 2.2.10 and I haven't ever changed it with the upgrade to 2.3.3.

@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "MyRequest")
@XmlType(name = "", propOrder = {} )
public class MyRequest
{
...
}

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Wednesday, May 18, 2011 1:17 PM
To: users@cxf.apache.org
Cc: Kessel, Christopher
Subject: Re: 2.3.3 WSDL generation creates duplicates (2.2.10 didn't)


Not really sure.   What annotations do you have on your "MyRequest" and 
"MyResponse" objects?    It LOOKS like you don't have an @XmlType annotation 
on them and likely only an XmlRootElement annotation.   My suggestion would be 
to have both.

Basically, the newer versions of JAXB are bit more strict about having proper 
annotations.   If a field or similar is a type that is only "allowed" to be a 
root, then it tends to copy the whole thing into the schema.   I'm not sure 
why.   However, making it be a XmlType as well would allow it to reference it 
directly.

Dan


On Tuesday, May 17, 2011 3:08:13 PM Kessel, Christopher wrote:
> I'm using 2.3.3 with a project and the wsdl creation contains duplication
> of the web service request/response objects. elements. I'm generating the
> WSDL from the annotated Java code. I have an older project using 2.2.10
> and it only generates the 1st element definitions and references them
> where 2.3.3 is duplicating.
> 
> Any ideas why? Here's the wsdl snippets:
> 
> <wsdl:definitions name="test_v1" targetNamespace="http://mycompany.com"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://mycompany.com"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <wsdl:types>
>         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:tns="http:// mycompany.com" elementFormDefault="unqualified"
> targetNamespace="http:// mycompany.com" version="1.0"> <xs:element
> name="MyRequest">
>                 <xs:complexType>
>                        ...complicated generated type stuff here...
>                 </xs:complexType>
>             </xs:element>
>             <xs:element name="MyResponse">
>                 <xs:complexType>
>                        ...complicated generated type stuff here...
>                 </xs:complexType>
>             </xs:element>
>             <xs:element name="doSomethingExciting"
> type="tns:doSomethingExciting "/> <xs:element name="
> doSomethingExcitingResponse" type="tns:doSomethingExcitingResponse"/>
> <xs:complexType name="doSomethingExciting">
>                 <xs:sequence>
>                     <xs:element minOccurs="0" name="MyRequest">
>                         <xs:complexType>
>                              ...same complicated generated stuff that we
> had above... </xs:complexType>
>                     </xs:element>
>                 </xs:sequence>
>             </xs:complexType>
>             <xs:complexType name=" doSomethingExcitingResponse">
>                 <xs:sequence>
>                     <xs:element minOccurs="0" name="MyResponse">
>                         <xs:complexType>
>                              ...same complicated generated stuff that we
> had above... </xs:complexType>
>                     </xs:element>
>                 </xs:sequence>
>             </xs:complexType>
>         </xs:schema>
>     </wsdl:types>
>    ... wsdl type/binding/service stuff...
> </wsdl:definitions>

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

Re: 2.3.3 WSDL generation creates duplicates (2.2.10 didn't)

Posted by Daniel Kulp <dk...@apache.org>.
Not really sure.   What annotations do you have on your "MyRequest" and 
"MyResponse" objects?    It LOOKS like you don't have an @XmlType annotation 
on them and likely only an XmlRootElement annotation.   My suggestion would be 
to have both.

Basically, the newer versions of JAXB are bit more strict about having proper 
annotations.   If a field or similar is a type that is only "allowed" to be a 
root, then it tends to copy the whole thing into the schema.   I'm not sure 
why.   However, making it be a XmlType as well would allow it to reference it 
directly.

Dan


On Tuesday, May 17, 2011 3:08:13 PM Kessel, Christopher wrote:
> I'm using 2.3.3 with a project and the wsdl creation contains duplication
> of the web service request/response objects. elements. I'm generating the
> WSDL from the annotated Java code. I have an older project using 2.2.10
> and it only generates the 1st element definitions and references them
> where 2.3.3 is duplicating.
> 
> Any ideas why? Here's the wsdl snippets:
> 
> <wsdl:definitions name="test_v1" targetNamespace="http://mycompany.com"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://mycompany.com"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <wsdl:types>
>         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:tns="http:// mycompany.com" elementFormDefault="unqualified"
> targetNamespace="http:// mycompany.com" version="1.0"> <xs:element
> name="MyRequest">
>                 <xs:complexType>
>                        ...complicated generated type stuff here...
>                 </xs:complexType>
>             </xs:element>
>             <xs:element name="MyResponse">
>                 <xs:complexType>
>                        ...complicated generated type stuff here...
>                 </xs:complexType>
>             </xs:element>
>             <xs:element name="doSomethingExciting"
> type="tns:doSomethingExciting "/> <xs:element name="
> doSomethingExcitingResponse" type="tns:doSomethingExcitingResponse"/>
> <xs:complexType name="doSomethingExciting">
>                 <xs:sequence>
>                     <xs:element minOccurs="0" name="MyRequest">
>                         <xs:complexType>
>                              ...same complicated generated stuff that we
> had above... </xs:complexType>
>                     </xs:element>
>                 </xs:sequence>
>             </xs:complexType>
>             <xs:complexType name=" doSomethingExcitingResponse">
>                 <xs:sequence>
>                     <xs:element minOccurs="0" name="MyResponse">
>                         <xs:complexType>
>                              ...same complicated generated stuff that we
> had above... </xs:complexType>
>                     </xs:element>
>                 </xs:sequence>
>             </xs:complexType>
>         </xs:schema>
>     </wsdl:types>
>    ... wsdl type/binding/service stuff...
> </wsdl:definitions>

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