You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Sameer Pokarna (JIRA)" <ax...@ws.apache.org> on 2007/10/03 11:32:50 UTC

[jira] Created: (AXIS-2699) Missing schema for http://util.java

Missing schema for http://util.java
-----------------------------------

                 Key: AXIS-2699
                 URL: https://issues.apache.org/jira/browse/AXIS-2699
             Project: Axis
          Issue Type: Bug
          Components: WSDL processing
    Affects Versions: 1.3
            Reporter: Sameer Pokarna


We use Axis 1.3 for generating WSDL for Java classes. I found a bug while generating a WSDL for the enclosed class (MultipleEnumeration.java).
When I compile this class and run this against the Java2WSDL utility, I get the wsdl as attached (MultipleEnumerationIncorrect.wsdl). I am also attaching a correct WSDL after making the fix.


Bug:
The WSDL is not using xsd:anyType for one of the Enumeration fields. The schema for http://util.java is missing too leading to an incorrect WSDL.

The bug seems to be in the org.apache.axis.wsdl.fromJava.Types class, private boolean makeTypeElement(Class type, QName qName, Element containingElement) method.

The original code looks like this:

        // If we've already got this type (because it's a native type or
        // because we've already written it), just add the type="" attribute
        // (if appropriate) and return.
        if (!addToTypesList(qName) && !anonymous) {
            if (containingElement != null) {
                containingElement.setAttribute("type", getQNameString(qName));
            }
            return true;
        }

        // look up the serializer in the TypeMappingRegistry
        SerializerFactory factory;
        factory = (SerializerFactory) tm.getSerializer(type, qName);
 
        // If no factory is found, use the BeanSerializerFactory
        // if applicable, otherwise issue errors and treat as an anyType
        if (factory == null) {
            if (isEnumClass(type)) {
                factory = new EnumSerializerFactory(type, qName);
            } else if (isBeanCompatible(type, true)) {
                factory = new BeanSerializerFactory(type, qName);
            } else {
                return false;
            }
        }
 
        // factory is not null
        Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
 
        // if we can't get a serializer, that is bad.
        if (ser == null) {
            throw new AxisFault(Messages.getMessage("NoSerializer00",
                    type.getName()));
        }
 
        Element typeEl;
 
        try {
            typeEl = ser.writeSchema(type, this);
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }
 
Here, please note that the types list is constructed before checking if a factory exists for the type. For some types which result in anyType, the subsequent code returns false, and the schema for it is not written.

Fix:
The fix for this is to add the type to the typed list only if the factory is found for the class under consideration, and before the schema is written. So, the code will look like this.

        // look up the serializer in the TypeMappingRegistry
        SerializerFactory factory;
        factory = (SerializerFactory) tm.getSerializer(type, qName);
 
        // If no factory is found, use the BeanSerializerFactory
        // if applicable, otherwise issue errors and treat as an anyType
        if (factory == null) {
            if (isEnumClass(type)) {
                factory = new EnumSerializerFactory(type, qName);
            } else if (isBeanCompatible(type, true)) {
                factory = new BeanSerializerFactory(type, qName);
            } else {
                return false;
            }
        }
 
        // If we've already got this type (because it's a native type or
        // because we've already written it), just add the type="" attribute
        // (if appropriate) and return.
        if (!addToTypesList(qName) && !anonymous) {
            if (containingElement != null) {
                containingElement.setAttribute("type", getQNameString(qName));
            }
 
            return true;
        }
 
        // factory is not null
        Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
 
        // if we can't get a serializer, that is bad.
        if (ser == null) {
            throw new AxisFault(Messages.getMessage("NoSerializer00",
                    type.getName()));
        }
 
        Element typeEl;
 
        try {
            typeEl = ser.writeSchema(type, this);
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }
 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS-2699) Missing schema for http://util.java

Posted by "Sameer Pokarna (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS-2699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sameer Pokarna updated AXIS-2699:
---------------------------------

    Attachment: Types.java

Correct file Types.java. The change has been done in MakeTypesElement method, and is made as against the revision dated 10/10/2007.


> Missing schema for http://util.java
> -----------------------------------
>
>                 Key: AXIS-2699
>                 URL: https://issues.apache.org/jira/browse/AXIS-2699
>             Project: Axis
>          Issue Type: Bug
>          Components: WSDL processing
>    Affects Versions: 1.3
>            Reporter: Sameer Pokarna
>         Attachments: MultipleEnumeration.java, MultipleEnumerationCorrect.wsdl, MultipleEnumerationIncorrect.wsdl, Types.java
>
>
> We use Axis 1.3 for generating WSDL for Java classes. I found a bug while generating a WSDL for the enclosed class (MultipleEnumeration.java).
> When I compile this class and run this against the Java2WSDL utility, I get the wsdl as attached (MultipleEnumerationIncorrect.wsdl). I am also attaching a correct WSDL after making the fix.
> Bug:
> The WSDL is not using xsd:anyType for one of the Enumeration fields. The schema for http://util.java is missing too leading to an incorrect WSDL.
> The bug seems to be in the org.apache.axis.wsdl.fromJava.Types class, private boolean makeTypeElement(Class type, QName qName, Element containingElement) method.
> The original code looks like this:
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>             return true;
>         }
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  
> Here, please note that the types list is constructed before checking if a factory exists for the type. For some types which result in anyType, the subsequent code returns false, and the schema for it is not written.
> Fix:
> The fix for this is to add the type to the typed list only if the factory is found for the class under consideration, and before the schema is written. So, the code will look like this.
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>  
>             return true;
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS-2699) Missing schema for http://util.java

Posted by "Sameer Pokarna (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS-2699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sameer Pokarna updated AXIS-2699:
---------------------------------

    Attachment: MultipleEnumerationCorrect.wsdl

WSDL as generated by the fix to Types.java as recommended in the bug description.

> Missing schema for http://util.java
> -----------------------------------
>
>                 Key: AXIS-2699
>                 URL: https://issues.apache.org/jira/browse/AXIS-2699
>             Project: Axis
>          Issue Type: Bug
>          Components: WSDL processing
>    Affects Versions: 1.3
>            Reporter: Sameer Pokarna
>         Attachments: MultipleEnumeration.java, MultipleEnumerationCorrect.wsdl, MultipleEnumerationIncorrect.wsdl
>
>
> We use Axis 1.3 for generating WSDL for Java classes. I found a bug while generating a WSDL for the enclosed class (MultipleEnumeration.java).
> When I compile this class and run this against the Java2WSDL utility, I get the wsdl as attached (MultipleEnumerationIncorrect.wsdl). I am also attaching a correct WSDL after making the fix.
> Bug:
> The WSDL is not using xsd:anyType for one of the Enumeration fields. The schema for http://util.java is missing too leading to an incorrect WSDL.
> The bug seems to be in the org.apache.axis.wsdl.fromJava.Types class, private boolean makeTypeElement(Class type, QName qName, Element containingElement) method.
> The original code looks like this:
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>             return true;
>         }
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  
> Here, please note that the types list is constructed before checking if a factory exists for the type. For some types which result in anyType, the subsequent code returns false, and the schema for it is not written.
> Fix:
> The fix for this is to add the type to the typed list only if the factory is found for the class under consideration, and before the schema is written. So, the code will look like this.
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>  
>             return true;
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS-2699) Missing schema for http://util.java

Posted by "Sameer Pokarna (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS-2699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sameer Pokarna updated AXIS-2699:
---------------------------------


I have updated this bug with the fix. Can some one who has commit rights review, and commit, if appropriate?

> Missing schema for http://util.java
> -----------------------------------
>
>                 Key: AXIS-2699
>                 URL: https://issues.apache.org/jira/browse/AXIS-2699
>             Project: Axis
>          Issue Type: Bug
>          Components: WSDL processing
>    Affects Versions: 1.3
>            Reporter: Sameer Pokarna
>         Attachments: MultipleEnumeration.java, MultipleEnumerationCorrect.wsdl, MultipleEnumerationIncorrect.wsdl, Types.java
>
>
> We use Axis 1.3 for generating WSDL for Java classes. I found a bug while generating a WSDL for the enclosed class (MultipleEnumeration.java).
> When I compile this class and run this against the Java2WSDL utility, I get the wsdl as attached (MultipleEnumerationIncorrect.wsdl). I am also attaching a correct WSDL after making the fix.
> Bug:
> The WSDL is not using xsd:anyType for one of the Enumeration fields. The schema for http://util.java is missing too leading to an incorrect WSDL.
> The bug seems to be in the org.apache.axis.wsdl.fromJava.Types class, private boolean makeTypeElement(Class type, QName qName, Element containingElement) method.
> The original code looks like this:
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>             return true;
>         }
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  
> Here, please note that the types list is constructed before checking if a factory exists for the type. For some types which result in anyType, the subsequent code returns false, and the schema for it is not written.
> Fix:
> The fix for this is to add the type to the typed list only if the factory is found for the class under consideration, and before the schema is written. So, the code will look like this.
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>  
>             return true;
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS-2699) Missing schema for http://util.java

Posted by "Sameer Pokarna (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS-2699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sameer Pokarna updated AXIS-2699:
---------------------------------

    Attachment: MultipleEnumerationIncorrect.wsdl

WSDL as generated by current codebase

> Missing schema for http://util.java
> -----------------------------------
>
>                 Key: AXIS-2699
>                 URL: https://issues.apache.org/jira/browse/AXIS-2699
>             Project: Axis
>          Issue Type: Bug
>          Components: WSDL processing
>    Affects Versions: 1.3
>            Reporter: Sameer Pokarna
>         Attachments: MultipleEnumeration.java, MultipleEnumerationIncorrect.wsdl
>
>
> We use Axis 1.3 for generating WSDL for Java classes. I found a bug while generating a WSDL for the enclosed class (MultipleEnumeration.java).
> When I compile this class and run this against the Java2WSDL utility, I get the wsdl as attached (MultipleEnumerationIncorrect.wsdl). I am also attaching a correct WSDL after making the fix.
> Bug:
> The WSDL is not using xsd:anyType for one of the Enumeration fields. The schema for http://util.java is missing too leading to an incorrect WSDL.
> The bug seems to be in the org.apache.axis.wsdl.fromJava.Types class, private boolean makeTypeElement(Class type, QName qName, Element containingElement) method.
> The original code looks like this:
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>             return true;
>         }
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  
> Here, please note that the types list is constructed before checking if a factory exists for the type. For some types which result in anyType, the subsequent code returns false, and the schema for it is not written.
> Fix:
> The fix for this is to add the type to the typed list only if the factory is found for the class under consideration, and before the schema is written. So, the code will look like this.
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>  
>             return true;
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS-2699) Missing schema for http://util.java

Posted by "Sameer Pokarna (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS-2699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sameer Pokarna updated AXIS-2699:
---------------------------------

    Attachment: MultipleEnumeration.java

Java file for which WSDL file can be generated using Java2WSDL.

> Missing schema for http://util.java
> -----------------------------------
>
>                 Key: AXIS-2699
>                 URL: https://issues.apache.org/jira/browse/AXIS-2699
>             Project: Axis
>          Issue Type: Bug
>          Components: WSDL processing
>    Affects Versions: 1.3
>            Reporter: Sameer Pokarna
>         Attachments: MultipleEnumeration.java, MultipleEnumerationIncorrect.wsdl
>
>
> We use Axis 1.3 for generating WSDL for Java classes. I found a bug while generating a WSDL for the enclosed class (MultipleEnumeration.java).
> When I compile this class and run this against the Java2WSDL utility, I get the wsdl as attached (MultipleEnumerationIncorrect.wsdl). I am also attaching a correct WSDL after making the fix.
> Bug:
> The WSDL is not using xsd:anyType for one of the Enumeration fields. The schema for http://util.java is missing too leading to an incorrect WSDL.
> The bug seems to be in the org.apache.axis.wsdl.fromJava.Types class, private boolean makeTypeElement(Class type, QName qName, Element containingElement) method.
> The original code looks like this:
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>             return true;
>         }
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  
> Here, please note that the types list is constructed before checking if a factory exists for the type. For some types which result in anyType, the subsequent code returns false, and the schema for it is not written.
> Fix:
> The fix for this is to add the type to the typed list only if the factory is found for the class under consideration, and before the schema is written. So, the code will look like this.
>         // look up the serializer in the TypeMappingRegistry
>         SerializerFactory factory;
>         factory = (SerializerFactory) tm.getSerializer(type, qName);
>  
>         // If no factory is found, use the BeanSerializerFactory
>         // if applicable, otherwise issue errors and treat as an anyType
>         if (factory == null) {
>             if (isEnumClass(type)) {
>                 factory = new EnumSerializerFactory(type, qName);
>             } else if (isBeanCompatible(type, true)) {
>                 factory = new BeanSerializerFactory(type, qName);
>             } else {
>                 return false;
>             }
>         }
>  
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>             if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>  
>             return true;
>         }
>  
>         // factory is not null
>         Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
>  
>         // if we can't get a serializer, that is bad.
>         if (ser == null) {
>             throw new AxisFault(Messages.getMessage("NoSerializer00",
>                     type.getName()));
>         }
>  
>         Element typeEl;
>  
>         try {
>             typeEl = ser.writeSchema(type, this);
>         } catch (Exception e) {
>             throw AxisFault.makeFault(e);
>         }
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org