You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by ae...@rbc.com on 2005/07/13 17:52:43 UTC

No Helper class and deploy.wsdd incorrect for class containing an array of Strings

Hi,

I have a class that has one property, an array of strings. On its own it is not much use, but I have other classes that extend it so unless I get this resolved, I can't upgrade my application from using Axis1.1 rpc/encoded to Axis1.2.1 wrapped/literal 

My WSDL for the class is (see attached file test.wsdl for complete wsdl)

 <complexType name="StringArray">
    <sequence>
     <element name="values" nillable="true" maxOccurs="unbounded" type="xsd:string"/>
    </sequence>
   </complexType>

When I use the org.apache.axis.wsdl.WSDL2Java -command specifying the  --helperGen option, Axis doesn't generate a Helper class or class for the StringArray class.

The deploy.wsdd file contains an array mapping:rather than a type mapping:

 <arrayMapping
        xmlns:ns="http://test.axis"
        qname="ns:StringArray"
        type="java:java.lang.String[]"
        innerType="cmp-ns:string" xmlns:cmp-ns="http://www.w3.org/2001/XMLSchema"
        encodingStyle=""
      />

Calling a web service method that takes a StringArray as a parameter causes a Sax Exception as it says it has found characters when it is expecting an array.

If I add another property to the complex type definition, say a boolean 

   <complexType name="StringArray">
    <sequence>
     <element name="values" nillable="true" maxOccurs="unbounded" type="xsd:string"/>
     <element name="notInUse" type="xsd:boolean"/>
    </sequence>
   </complexType>

I do get the helper class with the following type description

 static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("http://test.axis", "StringArray"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("values");
        elemField.setXmlName(new javax.xml.namespace.QName("http://test.axis", "values"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setNillable(true);
        elemField.setMaxOccursUnbounded(true);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("notInUse");
        elemField.setXmlName(new javax.xml.namespace.QName("http://test.axis", "notInUse"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
    }


and the deploy.wsdd has a type mapping

<typeMapping
        xmlns:ns="http://test.axis"
        qname="ns:StringArray"
        type="java:axis.test.StringArray"
        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
        encodingStyle=""
      />

If I manually create a Helper class for the version of the class without a boolean property and edit the deploy.wsdd to have the type mapping rather than the array mapping, my application works.

If anyone knows of this as a known bug can you let me know so I can put a watch on it.

Thanks,

Aedemar


Environment: Axis Version: 1.2.1 <<test.wsdl>> 
Axis service deployed to websphere server
WebSphere Platform 5.1 [BASE 5.1.1 a0426.01] [JDK 1.4.2 cn1420-20040626] [PME 5.1.1 o0429.02]  running with process name localhost\localhost\server1 and process id 3052
Host Operating System is Windows 2000, version 5.0
Java version = J2RE 1.4.2 IBM Windows 32 build cn1420-20040626 (JIT enabled: jitc), Java Compiler = jitc, Java VM name = Classic VM

Microsoft Development Environment 2003
Microsoft .NET Framework 1.1
Microsoft Visual C# .NET 69586-335-0000007-18998 


__________________________________________________________________________________________________________________________________

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations.
Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized.
If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.  

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent.
Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite.
Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

Re: No Helper class and deploy.wsdd incorrect for class containing an array of Strings

Posted by Davanum Srinivas <da...@gmail.com>.
Please log a bug report and mark it a blocker.

-- dims

On 7/13/05, aedemar.cooke@rbc.com <ae...@rbc.com> wrote:
>  
> 
> Hi, 
> 
> I have a class that has one property, an array of strings. On its own it is
> not much use, but I have other classes that extend it so unless I get this
> resolved, I can't upgrade my application from using Axis1.1 rpc/encoded to
> Axis1.2.1 wrapped/literal 
> 
> My WSDL for the class is (see attached file test.wsdl for complete wsdl) 
> 
>  <complexType name="StringArray"> 
>     <sequence> 
>      <element name="values" nillable="true" maxOccurs="unbounded"
> type="xsd:string"/> 
>     </sequence> 
>    </complexType> 
> 
> When I use the org.apache.axis.wsdl.WSDL2Java -command specifying the 
> --helperGen option, Axis doesn't generate a Helper class or class for the
> StringArray class. 
> 
> The deploy.wsdd file contains an array mapping:rather than a type mapping: 
> 
>  <arrayMapping 
>         xmlns:ns="http://test.axis" 
>         qname="ns:StringArray" 
>         type="java:java.lang.String[]" 
>         innerType="cmp-ns:string"
> xmlns:cmp-ns="http://www.w3.org/2001/XMLSchema" 
>         encodingStyle="" 
>       /> 
> 
> Calling a web service method that takes a StringArray as a parameter causes
> a Sax Exception as it says it has found characters when it is expecting an
> array. 
> 
> If I add another property to the complex type definition, say a boolean 
> 
>    <complexType name="StringArray"> 
>     <sequence> 
>      <element name="values" nillable="true" maxOccurs="unbounded"
> type="xsd:string"/> 
>      <element name="notInUse" type="xsd:boolean"/> 
>     </sequence> 
>    </complexType> 
> 
> I do get the helper class with the following type description 
> 
>  static { 
>         typeDesc.setXmlType(new
> javax.xml.namespace.QName("http://test.axis", "StringArray")); 
>         org.apache.axis.description.ElementDesc elemField =
> new org.apache.axis.description.ElementDesc(); 
>         elemField.setFieldName("values"); 
>         elemField.setXmlName(new
> javax.xml.namespace.QName("http://test.axis", "values")); 
>         elemField.setXmlType(new
> javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
> "string")); 
>         elemField.setNillable(true); 
>         elemField.setMaxOccursUnbounded(true); 
>         typeDesc.addFieldDesc(elemField); 
>         elemField = new
> org.apache.axis.description.ElementDesc(); 
>         elemField.setFieldName("notInUse"); 
>         elemField.setXmlName(new
> javax.xml.namespace.QName("http://test.axis", "notInUse")); 
>         elemField.setXmlType(new
> javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
> "boolean")); 
>         elemField.setNillable(false); 
>         typeDesc.addFieldDesc(elemField); 
>     } 
>  
> 
> and the deploy.wsdd has a type mapping 
> 
> <typeMapping 
>         xmlns:ns="http://test.axis" 
>         qname="ns:StringArray" 
>         type="java:axis.test.StringArray" 
>        
> serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
>        
> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
>         encodingStyle="" 
>       /> 
> 
> If I manually create a Helper class for the version of the class without a
> boolean property and edit the deploy.wsdd to have the type mapping rather
> than the array mapping, my application works. 
> 
> If anyone knows of this as a known bug can you let me know so I can put a
> watch on it. 
> 
> Thanks, 
> 
> Aedemar 
>  
> 
> Environment: Axis Version: 1.2.1 <<test.wsdl>> 
> Axis service deployed to websphere server 
> WebSphere Platform 5.1 [BASE 5.1.1 a0426.01] [JDK 1.4.2 cn1420-20040626]
> [PME 5.1.1 o0429.02]  running with process name localhost\localhost\server1
> and process id 3052 
> 
> Host Operating System is Windows 2000, version 5.0 
> Java version = J2RE 1.4.2 IBM Windows 32 build cn1420-20040626 (JIT enabled:
> jitc), Java Compiler = jitc, Java VM name = Classic VM 
> 
> Microsoft Development Environment 2003 
> Microsoft .NET Framework 1.1 
> Microsoft Visual C# .NET 69586-335-0000007-18998 
> __________________________________________________________________________________________________________________________________
> 
> This e-mail may be privileged and/or confidential, and the sender does not
> waive any related rights and obligations.
> Any distribution, use or copying of this e-mail or the information it
> contains by other than an intended recipient is unauthorized.
> If you received this e-mail in error, please advise me (by return e-mail or
> otherwise) immediately. 
> 
> Ce courrier électronique est confidentiel et protégé. L'expéditeur ne
> renonce pas aux droits et obligations qui s'y rapportent.
> Toute diffusion, utilisation ou copie de ce message ou des renseignements
> qu'il contient par une personne autre que le (les) destinataire(s)
> désigné(s) est interdite.
> Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser
> immédiatement, par retour de courrier électronique ou par un autre moyen.
>  
> 


-- 
Davanum Srinivas -http://blogs.cocoondev.org/dims/