6 Replies Latest reply on Oct 12, 2004 1:08 PM by Thomas Diesler

    Mapping arrays

    manica Newbie

      JBoss4.0.0RC2. I have a webservice endpoint that takes a valueobject as a parameter:
      public void submit(InventoryUpdate update) throws RemoteException;

      This works great. However, when I try to change the signature to take an array, it complains about not having a mapping for the array type. For example:

      public void submit(InventoryUpdate[] updates) throws RemoteException;
      Class not found: www.express-res.com.ArrayOf_tns1_InventoryUpdate

      How do I add this mapping? The valueobject is serializable and composed of basic types. Thank you!

      Darin

        • 1. Re: Mapping arrays
          manica Newbie

          I have a bit more info to include. Here is a snippet from the server.log:

          2004-09-06 22:59:29,423 WARN [org.jboss.webservice.deployment.TypeMappingDescription] Class not found: com.ehr.ejb.inventorycontrol.ArrayOfInventoryUpdate
          2004-09-06 22:59:29,424 DEBUG [org.jboss.webservice.client.ServiceImpl] Service configuration:
           <operation name='submit' qname='ns1:submit' returnQName='submitReturn' returnType='xsd:string' xmlns:ns1='http://inventorycontrol.ejb.ehr.co
          m' >
           <parameter name='in0' qname='in0' mode='IN' type='ns1:ArrayOfInventoryUpdate' xmlns:ns1='http://inventorycontrol.ejb.ehr.com' />
           </operation>
          
           <!-- Ignore type mapping
           <typeMapping
           qname='ns1:ArrayOfInventoryUpdate' xmlns:ns1='http://inventorycontrol.ejb.ehr.com'
           type='java:com.ehr.ejb.inventorycontrol.ArrayOfInventoryUpdate'
           serializer='null'
           deserializer='null'
           encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
           </typeMapping>
           -->
          


          And, here is a snippet from the WSDL:
          <complexType name="ArrayOfInventoryUpdate">
           <complexContent>
           <restriction base="soapenc:Array">
           <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:InventoryUpdate[]"/>
           </restriction>
           </complexContent>
           </complexType>
          


          It appears that it is looking for the object "com.ehr.ejb.inventorycontrol.ArrayOfInventoryupdate", which doesn't exist. (The method signature takes an InventoryUpdate[], not an ArrayOfInventoryupdate.)

          Thank you!
          Darin

          • 2. Re: Mapping arrays
            Alon Agmon Newbie

            not sure i understand the problem but check ...

            1.that the value object's package is the same on the client/server

            2.that u mapped the objects correctly in the ws4ee-deployment.xml

            3.try to send one response object that contains the array eg

            public ....status ....{

            private sales[] ;

            check out the complex bean example in the wikki

            • 3. Re: Mapping arrays
              Gerhard Otte Newbie

              Hello !

              Have you found a solution to this problem ? I'm experiencing the same behavior when returning an array of complextype.

              TIA Gerhard

              • 4. Re: Mapping arrays
                Thomas Diesler Master

                Beware that rpc/encoded violates the BasicProfile R1006. You should stick with document/literal or rpc/literal.

                I'll put an example on the wiki that shows arrays of custom objects.

                • 5. Re: Mapping arrays
                  h.w. Newbie

                  Hello,

                  my client throws the following exception, when I try to get an array of
                  complex types:
                  [java] 2004-10-07 16:23:16,541 ERROR
                  org.apache.axis.client.Call[main] - Exception:
                  [java] org.xml.sax.SAXException: SimpleDeserializer encountered a
                  child element, which is NOT expected, in something it was trying to
                  deserialize.
                  ....
                  The wsdl file is generated by org.apache.axis.wsdl.Java2WSDL, style=RPC
                  and the following typemapping is used:
                  <typeMapping
                  qname='ns1:DatabaseListDO'
                  xmlns:ns1='http://database.dbdb.ulbmuenster.de'
                  type='java:de.ulbmuenster.dbdb.database.DatabaseListDO'
                  serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
                  deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
                  encodingStyle=''
                  />
                  <typeMapping
                  qname='ns1:DatabaseListDOArray'
                  xmlns:ns1='http://database.dbdb.ulbmuenster.de'
                  type='java:de.ulbmuenster.dbdb.database.DatabaseListDOArray'
                  serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
                  deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
                  encodingStyle=''
                  />

                  The used java-classes (complex type and array wrapper) are analogoue to the example in the wikis. No error occurs, if the return type is
                  one complex class.

                  Is there any solution for this problem?

                  Hendrik

                  • 6. Re: Mapping arrays
                    Thomas Diesler Master

                    Try generating your wsdl/jaxrpc-mapping.xml with JWSDP-1.4 wscompile