1 Reply Latest reply on Jun 15, 2005 9:06 AM by ameisinger

    SimpleDeserializer encountered a child element which is not

      Hi there,

      I tried to implement a webservice which returns a String of my int Array, but it does not work. The following error will appear:

      Error-Message:

      SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.


      Web-Service
      public String setInts(IntArray intAry) {
       return intAry.toString();
      }
      


      I put the Array in a wrapper-class as described in the Wiki http://wiki.jboss.org/wiki/Wiki.jsp?page=WSArrayTypeMapping. I hope that this works for int-Arrays like for custom types.

      IntArray-class
      public class IntArray {
       private int[] intArray;
       public int[] getIntArray() {
       return intArray;
       }
       public void setIntArray(int[] intArray) {
       this.intArray = intArray;
       }
      }
      


      ws4ee-deployment.xml
      <typeMapping
       qname='ns1:IntArray'
       xmlns:ns1='http://types.zoo.ams'
       type='java:interfaces.IntArray'
       serializer='org.jboss.axis.encoding.ser.BeanSerializerFactory'
       deserializer='org.jboss.axis.encoding.ser.BeanDeserializerFactory'
       encodingStyle=''>
      
      </typeMapping>
      
      <typeMapping
       qname='ns1:IntArrayResponse'
       xmlns:ns1='http://types.zoo.ams'
       type='java:interfaces.IntArray'
       serializer='org.jboss.axis.encoding.ser.BeanSerializerFactory'
       deserializer='org.jboss.axis.encoding.ser.BeanDeserializerFactory'
       encodingStyle=''>
      </typeMapping>
      


      After creating a client for this Webservice there are two new class-files: ArrayOf_xsd_int.java and IntArray.java

      Client-code
       int[] intAry = {1,2,3,4,5};
       ArrayOf_xsd_int xsdIntAry = new ArrayOf_xsd_int();
       IntArray intArray = new IntArray();
       xsdIntAry.setItem(intAry);
       intArray.setIntArray(xsdIntAry);
       System.out.println("setInts: " + endpoint.setInts(intArray));
      


      First question of two, for what is the ArrayOf_xsd_int?
      Second, why does my webservice not work?

      Thanks in advance for your help!

        • 1. Re: SimpleDeserializer encountered a child element which is

          Hi,

          I created my mapping.xml and wsdl file with wscompile. Now it works. Before this I've created the files with Java2WSDL. Althaugh it seems to work for single custom type, for arrays it does not work, because of the Java2WSDL command, I guess. During generating the client-files the IDE created an additional client-file called arrayOf_xsd_xxx.

          I don't know for what this file is - it does not matter because by using wscompile it works without this arrayOf_xsd_xxx files.


          Regards,
          Alex