Invalid WSDL create for abstract class
--------------------------------------

                 Key: XFIRE-885
                 URL: http://jira.codehaus.org/browse/XFIRE-885
             Project: XFire
          Issue Type: Bug
          Components: Aegis Module
    Affects Versions: 1.2.4
         Environment: JDK 1.4 and 5
            Reporter: Joost den Boer
         Assigned To: Dan Diephouse
         Attachments: BeanType.java

On XFire 1.2.4. when an abstract class extends another (abstract) class, the 
WSDL generated for this class is not confirm WSDL standards.
The 'abstract' attribute is added to the 'complexContent' element in stead to 
the 'complexType' element.
Validator like XmlSpy and IBM Rad detect this WSDL error.

Cause:
The error is caused by BeanType.writeSchema(Element) method. If the type is an 
extention, a 'complextContent' element is created which then become the 'root' 
element for the rest of this method.
The 'abstract' attribute is added to this root element after it has been 
replaced by the 'complexContent' element. Therefore this error only occurs if 
the abstract class extends another (abstract) class itself.

Fix:
The fix is easy. The small codeblock to add the 'abstract' attribute is put 
before the codeblock which creates the 'complexContent' element.
I attached the complete code of the BeanType class including this fix.
Code snippit :

        /*
         * WSDL error fix. Adding abstract attribute before creating 
complexContent element
         * See Java Virtual Machine specification:
         * 
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734
         */
        if (((info.getTypeClass().getModifiers() & Modifier.ABSTRACT) != 0) &&
                !info.getTypeClass().isInterface())
        {
            complex.setAttribute(new Attribute("abstract", "true"));
        }
       
        /**
         * WSDL error fix : create complexContent after abstract attribute is 
added to complexType element
         */
        if (info.isExtension() && sooperType != null)
        {
            Element complexContent = new Element("complexContent", 
SoapConstants.XSD_PREFIX,
                    SoapConstants.XSD);
            complex.addContent(complexContent);
            complex = complexContent;
        }

I attached the BeanType source including this fix.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to