axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sagara Gunathunga <sagara.gunathu...@gmail.com>
Subject Re: Problem passing Objects to Web services using client stub
Date Thu, 05 Nov 2009 08:33:07 GMT
On Thu, Nov 5, 2009 at 11:10 AM, ShwetaTripathi
<Shweta_Tripathi01@infosys.com> wrote:
>
> Hi ,
> I am getting an instantiation exception while calling a Web Service using
> stub generated from wsdl2Java tool.
> The problem description is as follows:
>
> Class A -Abstract Class with parameter A1 and A2 and getters and setters for
> A1 and A2
> Class B -Extends Class A.Has parameters B1 and B2 and getters and setters
> for B1 and B2
> Class Calculator -contains  method add(A a) which takes A's reference as
> parameter .This reference points to  object of class B.I have published this
> method as a web service.

In order to invoke method add(A a)  axis2 try to instantiate object of
 class A , since A is an abstract class you got this instantiation
exception . Instead of A use concrete class B as a method parameter .

Thanks,


>
> Using the wsdl generated I have created stubs using Axis wsdl2Java tool.
>
>
> I wrote client code as follows:
>
>        CalculatorStub calc=new CalculatorStub();
>                CalculatorStub.Parent parent=new CalculatorStub.Parent();
>                CalculatorStub.Child child=new CalculatorStub.Child();
>                CalculatorStub.Add add=new CalculatorStub.Add();
>
>                parent.setA1(10);
>                parent.setA2(10);
>                child.setB1(10);
>                child.setB2(10);
>                parent.setChild(child);
>                add.setP(parent);
>        Line 1///       CalculatorStub.AddResponse response= calc.add(add);
> When line 1 is reached then Iwhile calling calc.add(add) get an Axis
> exception as follows:
>
>
> 10:48:55,974 ERROR [AxisEngine]
> org.apache.axis2.AxisFault
>        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>        at
> org.apache.axis2.engine.DefaultObjectSupplier.getObject(DefaultObjectSupplier.java:30)
>        at
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:410)
>        at
> org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:722)
>        at
> org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:670)
>        at
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:602)
>        at org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:153)
>        at
> org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:188)
>        at
> org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
>        at
> org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
>        at
> org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
>        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
>        at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
>        at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>        at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>        at
> org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
>        at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
>        at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
>        at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>        at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>        at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>        at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>        at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
>        at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
>        at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>        at
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
>        at java.lang.Thread.run(Thread.java:595)
> Caused by: java.lang.InstantiationException
>        at
> sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
>        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>        at java.lang.Class.newInstance0(Class.java:350)
>        at java.lang.Class.newInstance(Class.java:303)
>        at
> org.apache.axis2.engine.DefaultObjectSupplier.getObject(DefaultObjectSupplier.java:28)
>        ... 33 more
>
> I am not getting what is the exact problem.
> Kindly suggest some solution
>
>
>
>
>
> --
> View this message in context: http://old.nabble.com/Problem-passing-Objects-to-Web-services-using-client-stub-tp26208578p26208578.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>



-- 
Sagara Gunathunga

Blog - http://ssagara.blogspot.com
Web - http://people.apache.org/~sagara/

Mime
View raw message