Hi all, I've been struggling with this for quite some time now, and it's time to post as I am about to go insane. Note that I posted this problem to the comp.lang.programmer group before receiving my subscription activation for this list. Here goes:
I have a class that returns an array of javabeans (ArticleBean). I want to expose this class as a web service using Axis. So far, I've been successful publishing/consuming simple web services, but I've had no success with anything that returns beans...even the provided sample won't work for me. Here's the relevant axis code from the web service client: String endpoint = "http://localhost:8080/ArticleSearchService/services/ArticleSearchImpl"; Service service = new Service(); Call call=null; call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); QName qn = new QName( "urn:ArticleBean", "ArticleBean" ); call.registerTypeMapping(ArticleBean.class, qn, new org.apache.axis.encoding.ser.BeanSerializerFactory(ArticleBean.class, qn), new org.apache.axis.encoding.ser.BeanDeserializerFactory(ArticleBean.class, qn)); call.setOperationName( new QName("ArticleSearchImpl", "searchByDoi") ); call.addParameter("doi", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType( XMLType.SOAP_ARRAY ); ab = (ArticleBean[]) call.invoke( new Object [] {doi}); And here's the deployment descriptor: <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="ArticleSearchImpl" provider="java:RPC"> <parameter name="className" value="ArticleSearchImpl"/> <parameter name="allowedMethods" value="*"/> <beanMapping qName="myNS:ArticleBean" xmlns:myNS="urn:ArticleBean" languageSpecificType="java:ArticleBean"/> </service> </deployment> If I view the wsdl at http://localhost:8080/ArticleSearchService/services/ArticleSearchImpl?wsdl, I get the following error: (snip) The value of the attribute "xmlns:tns1" is invalid. Prefixed namespace bindings may not be empty If I invoke a the client class (snippet above), I get "no deserializer defined for array type" in the error message. So.....I tried another approach: put my ArticleSearchImpl class into a package (ArticleSearch). use java2wsdl on this class; then, use wsdl2java, putting the auto-generated files into package ArticleSearch.ws. This worked well. however, it also put a new version of my ArticleBean class into this package as well, and the deploy.wsdd points to this bean. Then, I use the auto-generated ArticleSearchImplSoapBindingImpl to wrap my original class, something like this: import ArticleSearch.ArticleSearchImpl; public class ArticleSearchImplSoapBindingImpl implements ArticleSearch.ws.ArticleSearchImpl { ArticleSearchImpl searcher = new ArticleSearchImpl(); //my original class public ArticleSearch.ws.ArticleBean[] searchByAuthor(java.lang.String author) throws java.rmi.RemoteException { return searcher.searchByAuthor(author); } .... } The problem is that my original class returns an array of ArticleSearch.ArticleBean, not an array of ArticleSearch.ws.ArticleBean. Sticking (ArticleSearch.ws.ArticleBean[]) in front of the return value didn't help, either, as I suspected it wouldn't. So now I've progressed somewhat from my original problem, but i'm still stuck. I cannot believe that it's all that difficult to create this sucker, so I know I'm doing stupid things wrong. Since there is no documentation on the axis site for returning an array of beans, I'm appealing to you all for help. Thanks. Marc