Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-3682

Anonymous types in an exception aren't generated in WSDL

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • jbossws-cxf-4.2
    • jbossws-cxf
    • None

      This is a CXF issue: https://issues.apache.org/jira/browse/CXF-5208

      Anonymous types (annotated with @XmlType(name = "")) in an exception class aren't generated at all in WSDL.

      Web service classes:

      @WebService
      public class GreetingService {
        @WebMethod
        public void hello() throws MyException {}
        ...
      
      public class MyException extends Exception {
        private String     str;
        private MyAnonType myAnonObj;
      
        public String getStr() { return str; }
        public void setStr(String str) { this.str = str; }
      
        public MyAnonType getMyAnonObj() { return myAnonObj; }
        public void setMyAnonObj(MyAnonType myAnonObj) { this.myAnonObj = myAnonObj; }
        ...
      
      @XmlType(name = "")
      public class MyAnonType { ...
      

      Generated WSDL:

        <wsdl:types>
      <xs:schema ...>
        ...
        <xs:complexType name="MyException">
          <xs:sequence>
            <xs:element name="str" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      

      Note that the same type (MyAnonType) is generated in WSDL if the @XmlType(name = "") annotation is removed.

            [JBWS-3682] Anonymous types in an exception aren't generated in WSDL

            Tadayoshi Sato <tasato@redhat.com> changed the Status of bug 997380 from NEW to CLOSED

            RH Bugzilla Integration added a comment - Tadayoshi Sato <tasato@redhat.com> changed the Status of bug 997380 from NEW to CLOSED

            Resolved as a correct way to fix the issue is provided. See Grzegorz' comment at CXF-5208 for how to fix it.

            Tadayoshi Sato added a comment - Resolved as a correct way to fix the issue is provided. See Grzegorz' comment at CXF-5208 for how to fix it.

            Tadayoshi Sato <tasato@redhat.com> made a comment on bug 997380

            Platform BZ for https://issues.jboss.org/browse/JBWS-3682

            Anonymous types (annotated with @XmlType(name = "")) in an exception class aren't generated at all in WSDL.

            Web service classes:
            --------------------
            @WebService
            public class GreetingService {
            @WebMethod
            public void hello() throws MyException {}
            ...

            public class MyException extends Exception {
            private String str;
            private MyAnonType myAnonObj;

            public String getStr()

            { return str; }

            public void setStr(String str)

            { this.str = str; }

            public MyAnonType getMyAnonObj()

            { return myAnonObj; }

            public void setMyAnonObj(MyAnonType myAnonObj)

            { this.myAnonObj = myAnonObj; }

            ...

            @XmlType(name = "")
            public class MyAnonType { ...

            Generated WSDL:
            ---------------
            <wsdl:types>
            <xs:schema ...>
            ...
            <xs:complexType name="MyException">
            <xs:sequence>
            <xs:element name="str" nillable="true" type="xs:string"/>
            </xs:sequence>
            </xs:complexType>

            Note that the same type (MyAnonType) is generated in WSDL if the @XmlType(name = "") annotation is removed.

            RH Bugzilla Integration added a comment - Tadayoshi Sato <tasato@redhat.com> made a comment on bug 997380 Platform BZ for https://issues.jboss.org/browse/JBWS-3682 Anonymous types (annotated with @XmlType(name = "")) in an exception class aren't generated at all in WSDL. Web service classes: -------------------- @WebService public class GreetingService { @WebMethod public void hello() throws MyException {} ... public class MyException extends Exception { private String str; private MyAnonType myAnonObj; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public MyAnonType getMyAnonObj() { return myAnonObj; } public void setMyAnonObj(MyAnonType myAnonObj) { this.myAnonObj = myAnonObj; } ... @XmlType(name = "") public class MyAnonType { ... Generated WSDL: --------------- <wsdl:types> <xs:schema ...> ... <xs:complexType name="MyException"> <xs:sequence> <xs:element name="str" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> Note that the same type (MyAnonType) is generated in WSDL if the @XmlType(name = "") annotation is removed.

            Reproducer attached.

            Tadayoshi Sato added a comment - Reproducer attached.

              Unassigned Unassigned
              rhn-support-tasato Tadayoshi Sato
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: