6 Replies Latest reply on Apr 29, 2005 1:20 PM by Jason Greene

    Array element type mismatch error while accessing array of C

    Siddhartha Azad Newbie

      Hi,
      I am getting the following error message from JBoss 4.0.1 sp1 while acessing a method

      int printTypes(ComplexTypeArray ctr)


      ERROR [BeanPropertyTarget] Could not convert [Lbb.wseetest1.data.ComplexType; to bean f
      s[0]', type [Lbb.wseetest1.data.ComplexType;
      ERROR [RPCInvocation] java.lang.IllegalArgumentException: array element type mismatch
      egalArgumentException: array element type mismatch
      g.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:243)
      g.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:305)
      g.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(ArrayDeserializer.java:664)
      g.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:590)
      g.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl
      
      g.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:252)
      g.apache.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:138
      
      g.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:436)
      g.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextIm
      
      g.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
      g.apache.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:138
      
      g.apache.axis.message.RPCElement.deserialize(RPCElement.java:262)
      g.apache.axis.message.RPCElement.getParams(RPCElement.java:396)
      g.apache.axis.providers.java.RPCInvocation.prepareFromRequestEnvelope(RPCInvocation.java


      I am not sure why this is since the type of the ComplexType element that it is trying to assing to an element of the array, is the same
      [Lbb.wseetest1.data.ComplexType


      I am successfully able to access a method returning a ComplexType that is not an array, though.

      Please help.
      Thanks, Sid.

        • 1. Re: Array element type mismatch error while accessing array
          Jason Greene Master

          It looks like for some reason the arraydeserializer is being used instead of beandeserializer. Are you using a ws4ee-deployment.xml file? If you are, make sure the serializer and deserializer are set to the following:'

          serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
          deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'

          In most cases though, you won't need this file, so alternatively you can delete.

          If you are not using a ws4ee-deployment.xml file could you look in your $JBOSS_HOME/data/[webservice deployment]/[port component].wsdd

          and paste the type mapping.

          Thanks,
          -Jason

          • 2. Re: Array element type mismatch error while accessing array
            Siddhartha Azad Newbie

            Hi,
            I am using a ws4ee-deployment.xml file and the resulting .wsdd is pasted below:

            <deployment
             xmlns='http://xml.apache.org/axis/wsdd/'
             xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
             xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
             xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
             xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
            
            <service name='wseetest1.ear/wseetest1-ejb.jar#WseeEndpoint1' style='rpc' use='literal' provider='Handler'>
            
             <parameter name='webserviceID' value='wseetest1.ear/wseetest1-ejb.jar#WseeEndpoint1' />
             <parameter name='handlerClass' value='org.jboss.webservice.server.InvokerProviderEJB' />
            
             <operation name='getFirstName' qname='ns1:getFirstName' returnQName='getFirstNameReturn' returnType='xsd:string' xmlns:ns1='http://interfaces.wseetest1.bb' >
             <parameter name='in0' qname='in0' mode='IN' type='xsd:int' />
             </operation>
             <operation name='getNameType' qname='ns1:getNameType' returnQName='ns2:ComplexType' returnType='ns2:ComplexType' xmlns:ns1='http://interfaces.wseetest1.bb' xmlns:ns2='http://data.wseetest1.bb' >
             </operation>
             <operation name='printTypes' qname='ns1:printTypes' returnQName='printTypesReturn' returnType='xsd:int' xmlns:ns1='http://interfaces.wseetest1.bb' >
             <parameter name='in0' qname='ns2:ComplexTypeArray' mode='IN' type='ns2:ComplexTypeArray' xmlns:ns2='http://data.wseetest1.bb' />
             </operation>
            
             <!-- User defined type mapping -->
             <typeMapping
             qname='ns2:ComplexType' xmlns:ns2='http://data.wseetest1.bb'
             type='java:bb.wseetest1.data.ComplexType'
             serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
             deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
             encodingStyle=''>
             <typeDesc>
             </typeDesc>
             </typeMapping>
            
             <!-- User defined type mapping -->
             <typeMapping
             qname='ns2:ComplexTypeArray' xmlns:ns2='http://data.wseetest1.bb'
             type='java:bb.wseetest1.data.ComplexTypeArray'
             serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
             deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
             encodingStyle=''>
             <typeDesc>
             </typeDesc>
             </typeMapping>
            
             <!-- User defined type mapping -->
             <typeMapping
             qname='ns2:printTypesRequest' xmlns:ns2='http://data.wseetest1.bb'
             type='java:bb.wseetest1.data.ComplexTypeArray'
             serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
             deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
             encodingStyle=''>
             <typeDesc>
             </typeDesc>
             </typeMapping>
            
            
            </service>
            </deployment>
            
            


            I will also paste an excerpt from my .wsdl just in case:


            
            <wsdl:types>
             <schema targetNamespace="http://data.wseetest1.bb" xmlns="http://www.w3.org/2001/XMLSchema">
             <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
             <complexType name="ComplexType">
             <sequence>
             <element name="name" nillable="true" type="xsd:string"/>
             </sequence>
             </complexType>
             <complexType name="ComplexTypeArray">
             <sequence>
             <element name="elements" nillable="true" type="impl:ArrayOf_tns2_ComplexType"/>
             </sequence>
             </complexType>
             </schema>
             <schema targetNamespace="http://interfaces.wseetest1.bb" xmlns="http://www.w3.org/2001/XMLSchema">
             <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
             <complexType name="ArrayOf_tns2_ComplexType">
             <complexContent>
             <restriction base="soapenc:Array">
             <attribute ref="soapenc:arrayType" wsdl:arrayType="tns2:ComplexType[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
             </restriction>
             </complexContent>
             </complexType>
             </schema>
             </wsdl:types>
             <wsdl:message name="getNameTypeRequest">
             </wsdl:message>
             <wsdl:message name="getFirstNameRequest">
             <wsdl:part name="in0" type="xsd:int"/>
             </wsdl:message>
             <wsdl:message name="printTypesResponse">
             <wsdl:part name="printTypesReturn" type="xsd:int"/>
             </wsdl:message>
             <wsdl:message name="getFirstNameResponse">
             <wsdl:part name="getFirstNameReturn" type="xsd:string"/>
             </wsdl:message>
             <wsdl:message name="printTypesRequest">
             <wsdl:part name="in0" type="tns2:ComplexTypeArray"/>
             </wsdl:message>
             <wsdl:message name="getNameTypeResponse">
             <wsdl:part name="getNameTypeReturn" type="tns2:ComplexType"/>
             </wsdl:message>
             <wsdl:portType name="WseeEndpoint1">
             <wsdl:operation name="getFirstName" parameterOrder="in0">
             <wsdl:input name="getFirstNameRequest" message="impl:getFirstNameRequest"/>
             <wsdl:output name="getFirstNameResponse" message="impl:getFirstNameResponse"/>
             </wsdl:operation>
             <wsdl:operation name="getNameType">
             <wsdl:input name="getNameTypeRequest" message="impl:getNameTypeRequest"/>
             <wsdl:output name="getNameTypeResponse" message="impl:getNameTypeResponse"/>
             </wsdl:operation>
             <wsdl:operation name="printTypes" parameterOrder="in0">
             <wsdl:input name="printTypesRequest" message="impl:printTypesRequest"/>
             <wsdl:output name="printTypesResponse" message="impl:printTypesResponse"/>
             </wsdl:operation>
             </wsdl:portType>
            
            


            Thanks, Sid.


            • 3. Re: Array element type mismatch error while accessing array
              Siddhartha Azad Newbie

              Also, I tried without my ws4ee-deployment.xml and in this case the .wsdd uses the following mappings:

              <deployment
               xmlns='http://xml.apache.org/axis/wsdd/'
               xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
               xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
               xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
               xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
              
              <service name='wseetest1.ear/wseetest1-ejb.jar#WseeEndpoint1' style='rpc' use='literal' provider='Handler'>
              
               <parameter name='webserviceID' value='wseetest1.ear/wseetest1-ejb.jar#WseeEndpoint1' />
               <parameter name='handlerClass' value='org.jboss.webservice.server.InvokerProviderEJB' />
              
               <operation name='getFirstName' qname='ns1:getFirstName' returnQName='getFirstNameReturn' returnType='xsd:string' xmlns:ns1='http://interfaces.wseetest1.bb' >
               <parameter name='in0' qname='in0' mode='IN' type='xsd:int' />
               </operation>
               <operation name='getNameType' qname='ns1:getNameType' returnQName='ns2:ComplexType' returnType='ns2:ComplexType' xmlns:ns1='http://interfaces.wseetest1.bb' xmlns:ns2='http://data.wseetest1.bb' >
               </operation>
               <operation name='printTypes' qname='ns1:printTypes' returnQName='printTypesReturn' returnType='xsd:int' xmlns:ns1='http://interfaces.wseetest1.bb' >
               <parameter name='in0' qname='ns2:ComplexTypeArray' mode='IN' type='ns2:ComplexTypeArray' xmlns:ns2='http://data.wseetest1.bb' />
               </operation>
              
               <typeMapping
               qname='ns2:ComplexType' xmlns:ns2='http://data.wseetest1.bb'
               type='java:bb.wseetest1.data.ComplexType'
               serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
               deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
               encodingStyle=''>
               <typeDesc>
               <elementDesc fieldName='name' xmlName='name'/>
               <elementOrder> <element name='name'/>
               </elementOrder> </typeDesc>
               </typeMapping>
              
               <typeMapping
               qname='ns2:ComplexTypeArray' xmlns:ns2='http://data.wseetest1.bb'
               type='java:bb.wseetest1.data.ComplexTypeArray'
               serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
               deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
               encodingStyle=''>
               <typeDesc>
               <elementDesc fieldName='elements' xmlName='elements'/>
               <elementOrder> <element name='elements'/>
               </elementOrder> </typeDesc>
               </typeMapping>
              
              
              </service>
              </deployment>
              
              


              That is the MetaDataBeanSerializerFactory. I copied the last 2 typeMapping entries as they are into my ws4ee-deployment.xml and simply changed the Serializer/DeSerializers to org.apache.axis.encoding.ser.BeanSerializerFactory and so on, but whether I use the ws4ee-deployment.xml or not, I receive the same error message.
              Thanks.


              • 4. Re: Array element type mismatch error while accessing array
                Jason Greene Master

                Ah, the problem is you are using rpc/encoding (which is forbidden by the WS-I Basic Profile) you need to use rpc/literal.

                -Jason

                • 5. Re: Array element type mismatch error while accessing array
                  Siddhartha Azad Newbie

                  You are right, I have a DII client and I just did the following:

                  call.setProperty(ENCODING_STYLE_PROPERTY, "");
                  call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
                  


                  This also gave an error message,
                  14:33:30,750 ERROR [ServerEngine] Server error
                  java.lang.IllegalArgumentException: Namespace URI cannot be null
                   at org.apache.axis.utils.Mapping.setNamespaceURI(Mapping.java:87)

                  but it's a different one. I haven't used wscompile to generate the DII client and just wrote my own plus I haven't played around enough with it to complain yet :)
                  Thanks.

                  • 6. Re: Array element type mismatch error while accessing array
                    Jason Greene Master

                    There was a bug with handling empty namespaces that was fixed in the latest branch (will be included in 4.0.2).

                    -Jason