[ 
https://issues.apache.org/jira/browse/AXIS2-4923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Chapman updated AXIS2-4923:
--------------------------------

    Environment: 
Jave 1.5.0_08
Tomcat 5.5.18
Eclipse Helios Build id: 20100917-0705
Axis2 Tools (Eclipse XML Editors and Tools) Version: 
1.1.100.v201005241530-78-FF0DZRDKDDePSKwHj

  was:Jave 1.5.0_08, Tomcat 5.5.18


> Incorrect parse function for ArrayOfAnyType
> -------------------------------------------
>
>                 Key: AXIS2-4923
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4923
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.5.4
>         Environment: Jave 1.5.0_08
> Tomcat 5.5.18
> Eclipse Helios Build id: 20100917-0705
> Axis2 Tools (Eclipse XML Editors and Tools) Version: 
> 1.1.100.v201005241530-78-FF0DZRDKDDePSKwHj
>            Reporter: Andy Chapman
>
> Autogeneration of a client using a WSDL with a segment like this: 
> <s:complexType name="ArrayOfAnyType">
>   <s:sequence>
>     <s:element minOccurs="0" maxOccurs="unbounded" name="anyType" 
> nillable="true"/>
>   </s:sequence>
> </s:complexType>
> Generates a ArrayOfAnyType.Factory.parse method like this:
>                               try {
>                                       while (!reader.isStartElement() && 
> !reader.isEndElement())
>                                               reader.next();
>                                       if 
> (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type";)!=null){
>                                               java.lang.String fullTypeName = 
> reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance";, "type");
>                                               if (fullTypeName!=null){
>                                                       java.lang.String 
> nsPrefix = null;
>                                                       if 
> (fullTypeName.indexOf(":") > -1){
>                                                               nsPrefix = 
> fullTypeName.substring(0,fullTypeName.indexOf(":"));
>                                                       }
>                                                       nsPrefix = 
> nsPrefix==null?"":nsPrefix;
>                                                       java.lang.String type = 
> fullTypeName.substring(fullTypeName.indexOf(":")+1);
>                                                       if 
> (!"ArrayOfAnyType".equals(type)){
>                                                               //find 
> namespace for the prefix
>                                                               
> java.lang.String nsUri = 
> reader.getNamespaceContext().getNamespaceURI(nsPrefix);
>                                                               return 
> (ArrayOfAnyType)ExtensionMapper.getTypeObject(nsUri,type,reader);
>                                                       }
>                                               }
>                                       }
>                                       // Note all attributes that were 
> handled. Used to differ normal attributes
>                                       // from anyAttributes.
>                                       java.util.Vector handledAttributes = 
> new java.util.Vector();
>                                       reader.next();
>                                       while (!reader.isStartElement() && 
> !reader.isEndElement()) reader.next();
>                                       if (reader.isStartElement()){
>                                               nillableValue = 
> reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil";);
>                                               if 
> (!"true".equals(nillableValue) && !"1".equals(nillableValue)){
>                                                       java.lang.String 
> content = reader.getElementText();
>                                                       
> org.apache.axiom.om.OMFactory fac = 
> org.apache.axiom.om.OMAbstractFactory.getOMFactory();
>                                                       
> org.apache.axiom.om.OMNamespace omNs = 
> fac.createOMNamespace("http://apiconnector.com";, "");
>                                                       
> org.apache.axiom.om.OMElement _valueAnyType = fac.createOMElement("anyType", 
> omNs);
>                                                       
> _valueAnyType.addChild(fac.createOMText(_valueAnyType, content));
>                                                       
> object.setAnyType(_valueAnyType);
>                                               } else {
>                                                       
> reader.getElementText(); // throw away text nodes if any.
>                                               }
>                                               reader.next();
>                                       }  // End of if for expected property 
> start element
>                                       else {
>                                       }
>                                       while (!reader.isStartElement() && 
> !reader.isEndElement())
>                                               reader.next();
>                                       if (reader.isStartElement()) {
>                                               // A start element we are not 
> expecting indicates a trailing invalid property
>                                               throw new 
> org.apache.axis2.databinding.ADBException("Unexpected subelement " + 
> reader.getLocalName());
>                                       }
>                               } catch (javax.xml.stream.XMLStreamException e) 
> {
>                                       throw new java.lang.Exception(e);
>                               }
> Which basically reads the first element in the array and then treats the next 
> one as an unexpected element. So the error "Unexpected element anyType" is 
> produced.
> I regenerated the client using XMLBeans instead of ADB and it seems to be 
> fine.

-- 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to