Here's your problem: field.setXmlType(new javax.xml.namespace.QName("http://util.regisproject", "Product")); typeDesc.addFieldDesc(field); If you look at the WSDL definition of the field, it should have been ArrayOf_tns2_Product instead of Product.
If you change that, your service should work. Looks like the same bug to me :) - Navneet -----Original Message----- From: David Gilbert [mailto:[EMAIL PROTECTED]] Sent: Monday, February 10, 2003 10:14 PM To: [EMAIL PROTECTED] Subject: RE: deserializing a bean wrapped array of beans Maybe we don't have the same problem. I am assuming you used the WSDL2Java command to generate your beans. I have done the same on my code and reviewed the new beans. My parent bean (Catalog) seems to have the inner bean (Product) as an array for the getter and setter methods: public class Catalog implements java.io.Serializable { private regisproject.util.Product[] products; public Catalog() { } public regisproject.util.Product[] getProducts() { return products; } public void setProducts(regisproject.util.Product[] products) { this.products = products; } ... And the type metadata sections look like this: // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(Catalog.class); static { org.apache.axis.description.FieldDesc field = new org.apache.axis.description.ElementDesc(); field.setFieldName("products"); field.setXmlName(new javax.xml.namespace.QName("", "products")); field.setXmlType(new javax.xml.namespace.QName("http://util.regisproject", "Product")); typeDesc.addFieldDesc(field); }; /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } Is field.setXmlType where you changed Cow to ArrayOfCow? I changed mine to look like: field.setXmlType(new javax.xml.namespace.QName("http://util.regisproject", "ArrayOfProduct")); and field.setXmlType(new javax.xml.namespace.QName("http://util.regisproject", "Product[]")); and it still doesn't work. Am I in the right place? Did your original error say anything about "No deserializer for array type..."? I am thinking we have different problems, but I would like to understand your problem and fix to see if there is any relationship that could rub off to help fix my problem. -----Original Message----- From: Navneet Joneja [mailto:[EMAIL PROTECTED]] Sent: Monday, February 10, 2003 9:36 PM To: 'David Gilbert '; '[EMAIL PROTECTED] ' Subject: RE: deserializing a bean wrapped array of beans David, I edited the metadata in the generated bean (the bean that contains the array of other beans). In the XML type metadata, it had the type mentioned as Cow (where Cow was the nested bean), rather than ArrayOfCow, so I changed it to ArrayOfCow, and all was well. Sorry I can't send the actual code as it's proprietary, but I could send you the modified axis.jar that I built and you could try generating the client stubs with it and see if it works. - Navneet. -----Original Message----- From: David Gilbert To: [EMAIL PROTECTED] Sent: 2/10/2003 7:20 PM Subject: RE: deserializing a bean wrapped array of beans It certainly could - I am using the 1.1 beta also. Can you please explain how you got your service to work in more detail? Specifically, which meta data did you change - .wsdd or code? Can you send an example? Thanks. -----Original Message----- From: Navneet Joneja [mailto:[EMAIL PROTECTED]] Sent: Monday, February 10, 2003 6:19 PM To: '[EMAIL PROTECTED]' Cc: [EMAIL PROTECTED] Subject: RE: deserializing a bean wrapped array of beans Could this be related to the bug I just described? = Navnett -----Original Message----- From: Marc Esher [mailto:[EMAIL PROTECTED]] Sent: Monday, February 10, 2003 4:46 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: deserializing a bean wrapped array of beans David, Is this array coming from your client-side code that's callling the service? And can you successfully deploy the server-side code, get the service to appear in axis's list of service, and successfully view the wsdl? Marc -----Original Message----- From: David Gilbert [mailto:[EMAIL PROTECTED]] Sent: Monday, February 10, 2003 5:39 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: deserializing a bean wrapped array of beans Marc, I have done as instructed below, but still have the same problem with a new namespace. Conceptually I don't understand how Axis would know how to deserialize the Products within the Catalog without a namespace being provided for the Product object to assist in mapping to a deserializer. When I make the call to get the Catalog I specify the namespace that will be returned for the Catalog and Axis is able to map the object name and the namespace to the beanMapping or typeMapping. How would Axis know the namespace to use for looking up the deserialization mapping for Products if I don't specify it as part of the call? Both Catalog and Product currently use the same namespace, but when returning the Catalog I am still getting - org.xml.sax.SAXException: No deserializer defined for array type {http://util.regisproject}Product. Here are the new deploy.wsdd file contents: <!-- Use this file to deploy some handlers/chains and services --> <!-- Two ways to do this: --> <!-- java org.apache.axis.client.AdminClient deploy.wsdd --> <!-- after the axis server is running --> <!-- or --> <!-- java org.apache.axis.utils.Admin client|server deploy.wsdd --> <!-- from the same directory that the Axis engine runs --> <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <!-- Services from ProductDbHelperService WSDL service --> <service name="ProductDbHelper" provider="java:RPC" style="rpc" use="encoded"> <parameter name="wsdlTargetNamespace" value="urn:ProductDbHelper"/> <parameter name="className" value="regisproject.database.ProductDbHelper"/> <operation name="main" qname="operNS:main" xmlns:operNS="urn:ProductDbHelper" > <parameter name="args" type="tns:ArrayOf_xsd_string" xmlns:tns="urn:ProductDbHelper"/> </operation> <operation name="test" qname="operNS:test" xmlns:operNS="urn:ProductDbHelper" returnQName="testReturn" returnType="rtns:string" xmlns:rtns="http://www.w3.org/2001/XMLSchema" > <parameter name="msg" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/> </operation> <operation name="getProduct" qname="operNS:getProduct" xmlns:operNS="urn:ProductDbHelper" returnQName="getProductReturn" returnType="rtns:Product" xmlns:rtns="http://util.regisproject" > <parameter name="id" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/> </operation> <operation name="getCatalog" qname="operNS:getCatalog" xmlns:operNS="urn:ProductDbHelper" returnQName="getCatalogReturn" returnType="rtns:Catalog" xmlns:rtns="http://util.regisproject" > </operation> <operation name="getCatalog2" qname="operNS:getCatalog2" xmlns:operNS="urn:ProductDbHelper" returnQName="getCatalog2Return" returnType="rtns:Catalog2" xmlns:rtns="http://util.regisproject" > </operation> <parameter name="allowedMethods" value="main test getProduct getCatalog getCatalog2"/> <typeMapping xmlns:ns="urn:ProductDbHelper" qname="ns:ArrayOf_xsd_string" type="java:java.lang.String[]" serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="http://util.regisproject" qname="ns:Product" type="java:regisproject.util.Product" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="urn:ProductDbHelper" qname="ns:ArrayOf_tns2_Product" type="java:regisproject.util.Product[]" serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="urn:ProductDbHelper" qname="ns:ArrayOf_xsd_double" type="java:double[]" serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="http://util.regisproject" qname="ns:Catalog" type="java:regisproject.util.Catalog" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="http://util.regisproject" qname="ns:Catalog2" type="java:regisproject.util.Catalog2" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </service> </deployment> Here is my Catalog class: public class Catalog { private Product[] products; public Product[] getProducts() { return products; } public void setProducts(Product[] prods) { products = prods; } public Catalog(Product[] prods) { products = prods; } public Catalog() { } public static void main(String[] args) { Catalog catalog1 = new Catalog(); } } Is more needed here? -----Original Message----- From: Marc Esher [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 6:20 PM To: [EMAIL PROTECTED] Subject: RE: deserializing a bean wrapped array of beans David, I've been able to successfully return an array of objects, and each of those objects has an array of other objects. Here's my approach, which Gene Chuang helped me get started with back in January: 1) In some development directory, code the service. I keep all service classes and beans underneath the same root package (i.e. package mypkg; package mypkg.beans; and the like) 2) compile, then copy the root package to the $TOMCATHOME/webapps/axis/WEB-INF/classes directory thus, you might end up with $TOMCATHOME/webapps/axis/WEB-INF/classes/ArticleSearch3 3) from that directory, run java2wsdl. for example: java org.apache.axis.wsdl.Java2WSDL -o rticleSearcher3.wsdl -l"http://localhost:8080/axis/services/ArticleSearcher 3" -n urn:ArticleSearch3 -p"ArticleSearch3" urn:ArticleSearch3 ArticleSearch3.ArticleSearcher3 See the docs for an explanation of the switches and parameters 4) copy the generated wsdl into a temp folder 5) cd to your temp folder, and run wsdl2java with the server-side switch to get the deploy and undeploy.wsdd files. Here's what I put in the command line: java org.apache.axis.wsdl.WSDL2Java --server-side ArticleSearcher3.wsdl 6) Copy the deploy and undeploy.wsdd files to your service's directory (i.e. $TOMCATHOME/webapps/axis/WEB-INF/classes/ArticleSearch3) 7) Now comes the part that was hanging me up before: editing your deploy.wsdd file. Underneath the service element is a parameter element with the "className" attribute. This will probably be something like this: <parameter name="className" value="ArticleSearch3.ArticleSearcher3SoapBindingImpl"/> Delete the "SoapBindingImpl" part, such that you end up with <parameter name="className" value="ArticleSearch3.ArticleSearcher3"/> I also delete the wsdlServicePort, wsdlServiceElement, and wsdlPortType parameters, per Gene's advice, although I haven't studied the consequences of this yet. 8) If you've followed these steps so far, the deploy.wsdd should contain the appropriate typemappings, which I've pasted to the end of this email. You should see an array de/serializer mapping for each array, and a bean de/serializer for each bean class. This is what you're missing from the deploy.wsdd file. 9) make sure you're in your service's directory (..../classes/ArticleSearch3), and run the AdminClient, like so: java org.apache.axis.client.AdminClient deploy.wsdd 10) This should update your server-config.wsdd file in the webapps/axis/WEB-INF directory with the information for your new service. 11) go to axis's localhost homepage and view your list of services. Hopefully, it'll be there. To quickly see whether your service works (assuming you're able to view the wsdl), use the .NET Web Services Studio, which is available free from Microsoft. You just point it to your wsdl file, and it'll do the rest. It should prompt you with parameters to enter, and then it'll call your service and show you the results. in this deploy.wsdd, you'll notice ArticleSearch3 and ArticleSearcher3. This is just bad code on my part. ArticleSearch3 is the package name, and ArticleSearcher3 is my service's primary class. Good luck, David. Let us know how you make out. Marc ******* my deploy.wsdd, containing correct type mappings ******** <!-- Use this file to deploy some handlers/chains and services --> <!-- Two ways to do this: --> <!-- java org.apache.axis.client.AdminClient deploy.wsdd --> <!-- after the axis server is running --> <!-- or --> <!-- java org.apache.axis.utils.Admin client|server deploy.wsdd --> <!-- from the same directory that the Axis engine runs --> <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <!-- Services from ArticleSearcher3Service WSDL service --> <service name="ArticleSearcher3" provider="java:RPC" style="rpc" use="encoded"> <parameter name="wsdlTargetNamespace" value="urn:ArticleSearch3"/> <parameter name="className" value="ArticleSearch3.ArticleSearcher3"/> <operation name="main" qname="operNS:main" xmlns:operNS="urn:ArticleSearch3" > <parameter name="args" type="tns:ArrayOf_xsd_string" xmlns:tns="urn:ArticleSearch3"/> </operation> <operation name="searchByDoi" qname="operNS:searchByDoi" xmlns:operNS="urn:ArticleSearch3" returnQName="searchByDoiReturn" returnType="rtns:ArrayOfArticleBean" xmlns:rtns="urn:ArticleSearch3" > <parameter name="doi" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/> </operation> <operation name="searchByTitle" qname="operNS:searchByTitle" xmlns:operNS="urn:ArticleSearch3" returnQName="searchByTitleReturn" returnType="rtns:ArrayOfArticleBean" xmlns:rtns="urn:ArticleSearch3" > <parameter name="title" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/> </operation> <operation name="searchByKeywords" qname="operNS:searchByKeywords" xmlns:operNS="urn:ArticleSearch3" returnQName="searchByKeywordsReturn" returnType="rtns:ArrayOfArticleBean" xmlns:rtns="urn:ArticleSearch3" > <parameter name="keywords" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/> </operation> <operation name="searchByAuthor" qname="operNS:searchByAuthor" xmlns:operNS="urn:ArticleSearch3" returnQName="searchByAuthorReturn" returnType="rtns:ArrayOfArticleBean" xmlns:rtns="urn:ArticleSearch3" > <parameter name="author" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/> </operation> <operation name="ds_Close" qname="operNS:ds_Close" xmlns:operNS="urn:ArticleSearch3" > </operation> <parameter name="allowedMethods" value="main searchByDoi searchByTitle searchByKeywords searchByAuthor ds_Close"/> <typeMapping xmlns:ns="urn:ArticleSearch3" qname="ns:ArrayOf_xsd_string" type="java:java.lang.String[]" serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="urn:ArticleSearch3" qname="ns:AuthorBean" type="java:ArticleSearch3.AuthorBean" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="urn:ArticleSearch3" qname="ns:ArrayOfAuthorBean" type="java:ArticleSearch3.AuthorBean[]" serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="urn:ArticleSearch3" qname="ns:ArticleBean" type="java:ArticleSearch3.ArticleBean" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <typeMapping xmlns:ns="urn:ArticleSearch3" qname="ns:ArrayOfArticleBean" type="java:ArticleSearch3.ArticleBean[]" serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </service> </deployment> -----Original Message----- From: David Gilbert [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 8:58 PM To: [EMAIL PROTECTED] Subject: RE: deserializing a bean wrapped array of beans Thanks for the idea, but if add urn: to the beanMapping and use the urn: namespace on the client it still throws the same error. Has anyone else had any luck or experience with returning a bean that has an array of beans inside it? Does axis need to be told that one class holds members of another class, or should axis just deserialize bean objects as it finds them no matter what? Thanks for any ideas/help/thoughts, and especially answers. -----Original Message----- From: Olivier Gauwin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 2:03 AM To: [EMAIL PROTECTED] Subject: Re: deserializing a bean wrapped array of beans Hi David, I'm not sure your namespaces are well-formed. Try to add "urn:" at the beginning of your namespaces ("urn:ProductDbHelper" instead of "ProductDbHelper", etc). HTH, Olivier David Gilbert wrote: >I have seen postings about deserializing arrays from last >January, but didn't find an answer to my problem. I am >trying to pass an object from my service back to the client >and am getting a "no deserializer defined for array type >{regisproject.util}Product" error. The object being passed >back is a bean (catalog) that contains an array of bean >objects (products). Using TCPMon I see that the message >sent to the client has the right data - > > <soapenv:Body> > <ns1:getCatalogResponse >soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >xmlns:ns1="ProductDbHelper"> > <getCatalogReturn href="#id0"/> > </ns1:getCatalogResponse> > <multiRef id="id0" soapenc:root="0" >soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >xsi:type="ns2:Catalog" >xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >xmlns:ns2="regisproject.util"> > <products xsi:type="soapenc:Array" >soapenc:arrayType="ns2:Product[5]"> > <item href="#id1"/> > <item href="#id2"/> > <item href="#id3"/> > <item href="#id4"/> > <item href="#id5"/> > </products> > </multiRef> > <multiRef id="id4" soapenc:root="0" >soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >xsi:type="ns3:Product" xmlns:ns3="regisproject.util" >xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> > <description xsi:type="xsd:string" xsi:nil="true"/> > <id xsi:type="xsd:string">4 </id> > <inventory xsi:type="xsd:double">55.0</inventory> > <name xsi:type="xsd:string">Test Product 456</name> > <nextShipDate >xsi:type="xsd:dateTime">2003-01-01T07:00:00.000Z</nextShipDate> > <nextShipQty xsi:type="xsd:double">100.0</nextShipQty> > <price xsi:type="xsd:double">1234.56</price> > <status xsi:type="xsd:string">not active</status> > <vendorId xsi:type="xsd:string">3 </vendorId> > <vendorName >xsi:type="xsd:string">Parts-R-Us</vendorName> > </multiRef> > ... > >In my deploy.wsdd I have bean mappings for Product and >Catalog - > ><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"/> > <beanMapping qname="myNS:Product" > xmlns:myNS="regisproject.util" >languageSpecificType="java:regisproject.util.Product"/> > <beanMapping qname="myNS:Catalog" > xmlns:myNS="regisproject.util" >languageSpecificType="java:regisproject.util.Catalog"/> > </service> ></deployment> > >Do I need to add something for the array to the .wsdd? Any >ideas as to what else is needed? > >Note: I have another service that returns a single product >and it deserializes without any problem. > >Thanks for any help you can provide. > > > >