Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2.4
-
Fix Version/s: 1.2.5
-
Component/s: Aegis Module
-
Labels:None
-
Environment:JDK 1.4 and 5
-
Number of attachments :
Description
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.
Thanks Joost. Scheduling for 1.2.5