Return-Path: Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 15652 invoked by uid 500); 11 Feb 2003 01:19:09 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 15640 invoked from network); 11 Feb 2003 01:19:09 -0000 Message-ID: From: Navneet Joneja To: "'axis-user@ws.apache.org'" Cc: dgilbert@cragmonttech.com Subject: RE: deserializing a bean wrapped array of beans Date: Mon, 10 Feb 2003 17:19:11 -0800 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="ISO-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Could this be related to the bug I just described? = Navnett -----Original Message----- From: Marc Esher [mailto:jonnycattt@cablespeed.com] Sent: Monday, February 10, 2003 4:46 PM To: axis-user@ws.apache.org Cc: dgilbert@cragmonttech.com 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:dgilbert@cragmonttech.com] Sent: Monday, February 10, 2003 5:39 PM To: axis-user@ws.apache.org; jonnycattt@cablespeed.com 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: 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:jonnycattt@cablespeed.com] Sent: Friday, February 07, 2003 6:20 PM To: axis-user@ws.apache.org 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: Delete the "SoapBindingImpl" part, such that you end up with 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 ******** -----Original Message----- From: David Gilbert [mailto:dgilbert@cragmonttech.com] Sent: Thursday, February 06, 2003 8:58 PM To: axis-user@xml.apache.org 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:gauwin@campus.dtrd.de] Sent: Wednesday, February 05, 2003 2:03 AM To: axis-user@xml.apache.org 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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >xmlns:ns1="ProductDbHelper"> > > > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >xsi:type="ns2:Catalog" >xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >xmlns:ns2="regisproject.util"> > soapenc:arrayType="ns2:Product[5]"> > > > > > > > > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >xsi:type="ns3:Product" xmlns:ns3="regisproject.util" >xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> > > 4 > 55.0 > Test Product 456 > xsi:type="xsd:dateTime">2003-01-01T07:00:00.000Z > 100.0 > 1234.56 > not active > 3 > xsi:type="xsd:string">Parts-R-Us > > ... > >In my deploy.wsdd I have bean mappings for Product and >Catalog - > > xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> > > value="regisproject.database.ProductDbHelper"/> > value="test,getProduct,getCatalog"/> > xmlns:myNS="regisproject.util" >languageSpecificType="java:regisproject.util.Product"/> > xmlns:myNS="regisproject.util" >languageSpecificType="java:regisproject.util.Catalog"/> > > > >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. > > > >