axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Gilbert" <dgilb...@cragmonttech.com>
Subject a bug or missing information/documentation? deserializing beans within an array in a bean
Date Fri, 07 Feb 2003 19:02:48 GMT
I had originally submitted this question/issue to the axis-users and tried a
couple of ideas, but didn't find a working answer and wonder if this might
be an issue with the 1.1 beta release.  I am running with Tomcat 4.1.18.
Others have indicated this should be possible.

The problem I am hitting is that I can't get Axis to deserialize a bean that
is in an array within another bean.  I am trying to return a Catalog class
that has an array of Products.  Here is the error:

- Exception: org.xml.sax.SAXException: No deserializer defined for array
type {urn:regisproject.util}Product 	at
org.apache.axis.encoding.ser.ArrayDeserializer.onStartElement(ArrayDeseriali
zer.java:254) 	at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java
:428) 	at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextImpl.java:925) 	at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:200)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
693) 	at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java
:404) 	at
org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.
java:167) 	at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextImpl.java:925) 	at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:200)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
693) 	at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:299) 	at
org.apache.axis.message.RPCElement.getParams(RPCElement.java:323) 	at
org.apache.axis.client.Call.invoke(Call.java:2082) 	at
org.apache.axis.client.Call.invoke(Call.java:1986) 	at
org.apache.axis.client.Call.invoke(Call.java:1509) 	at
regisproject.serviceclient.ProductServiceClient.getCatalog(ProductServiceCli
ent.java:112) 	at
regisproject.serviceclient.ProductServiceClient.main(ProductServiceClient.ja
va:155) org.xml.sax.SAXException: No deserializer defined for array type
{urn:regisproject.util}Product

I have other methods using the same service that return a bean with arrays
of strings and doubles, and another method that returns a single Product
without any problem.  

Is there anything required by Axis to indicate the relationship between the
Catalog class and the Product class, or should Axis just deserialize objects
whenever it finds them based on the beanMappings of each bean independently?

Here is the wsdd used to deploy:

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
 <service name="ProductDbHelper" provider="java:RPC">
  <parameter name="className"
value="regisproject.database.ProductDbHelper"/>
  <parameter name="allowedMethods"
value="test,getProduct,getCatalog,getCatalog2"/>
  <beanMapping qname="myNS:Product" 
            xmlns:myNS="urn:regisproject.util"
languageSpecificType="java:regisproject.util.Product"/>
  <beanMapping qname="myNS:Catalog" 
            xmlns:myNS="urn:regisproject.util"
languageSpecificType="java:regisproject.util.Catalog"/>
  <beanMapping qname="myNS:Catalog2" 
            xmlns:myNS="urn:regisproject.util"
languageSpecificType="java:regisproject.util.Catalog2"/>
 </service>
</deployment>

Attached is the SOAP message from TCPMon.

 
Here is the call set-up:
  public Catalog getCatalog() throws Exception
  {
    Catalog catalog = null;

    Service  service = new Service();
    Call     call    = (Call) service.createCall();
    QName    qn      = new QName( "ProductDbHelper", "getCatalog" );
    QName    retQn   = new QName( "urn:regisproject.util", "Catalog" );

    call.registerTypeMapping(Catalog.class, retQn,
                  new
org.apache.axis.encoding.ser.BeanSerializerFactory(Catalog.class, retQn),
                  new
org.apache.axis.encoding.ser.BeanDeserializerFactory(Catalog.class, retQn));

    try
    {
      call.setTargetEndpointAddress( new java.net.URL(endpoint) );
      call.setOperationName(qn);

      //call.addParameter( "arg1",
org.apache.axis.encoding.XMLType.XSD_STRING, ParameterMode.IN);
      call.setReturnType( retQn, Catalog.class );

      catalog = (Catalog) call.invoke( new Object[] { } );
    }
    catch (Exception e)
    {
      System.err.println(e.toString());
    }

    return catalog;
  }//end getCatalog()


Let me know if any other info would be useful - or if I am just doing
something wrong.  If something needs to be documented on how to deserialize
arrays like this I would volunteer to do so, but would need to understand it
first :).

Thanks!

-----------------------------
David Gilbert
303.517.1297
Cragmont Technologies
Java, Siebel, and Database Design Services
www.cragmonttech.com


Mime
View raw message