You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by rinesh kumar agnihotri <ri...@rediffmail.com> on 2006/08/15 18:33:23 UTC

Interesting Observation - AXIS generated code

Hi all,I came across a very interesting situation recently. I am using AXIS 1.2.1 in my project to expose POJO as webservices. Following is the typical sequence that I follow:1. Write an interface with the methods to expose as services with their respective request and response objects.2. Generate WSDL using Java2WSDL tool.3. Use the WSDL2Java tool to generate the java code back. This step is essentially to generate the deployment descriptor and test case along with client and server classes.Now, The request and response objects for the services can have inheritance hierarchy i.e. lets say my request bean&nbsp; for one of the services is com.mycomp.payment.order.PaymentOrderReq extends com.mycomp.ws.WebServiceReq. When I generate the code in step 3 above the parent class is also generated in the same package as child req. class. I modify the descriptor (deploy.wsdd) and import staements in all the classes&nbsp;to have the origional parent class package. Also I change the \"cl
 assName\" (service endpoint)&nbsp;in deploy.wsdd to point to my service class.Also I remove the AXIS generated beans and use mine instead.Now I add &lt;service&gt; tag in deploy.wsdd to server-config.wsdd and deploy the code on server.If I look at the wsdl generated after deployment I see that my child and parent request beans are shown in different namespaces which is correct as they are in different packages and also the &lt;typeMapping&gt; element in the wsdd mentions different namespaces for them.Uptil now everything is okay. Now if you use the test case to call this service and look at the response you\'ll see that default namespace in the response is that of child class and parent class attributes are also shown in the same namespace. This is confusing and wrong considering that if I give the WSDL URL to a client to integrate with my service his parser is going to throw exceptions.One more thing, if I do not delete the TypeDesc code from the beans the response will sho
 wcorrect namespaces attached to every response element.&nbsp;My questions are as follows:1. When Java2WSDL can resolve the namespaces while generating the WSDL from the code, why is it not resolved when serializing the response bean?2. Is their a way to specify element descriptions, generated by AXIS in the beans, in the server-config.wsdd?I am more than willing to share any information on this. Let me know if you feel that I am missing somethings here.Cheers.