... my question is: please help me solve this issue.

 

Thanks,

Gábor

 

 


From: Prótár Gábor [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 20, 2006 4:46 PM
To: '[email protected]'
Subject: Axis2 RPC bug

 

Hello!

 

I have found a bug int he RPC style webservice handling.

 

I am using Tomcat v5.5.17, Axis 2 v1.0, MySQL v5.0.24, MySQL Connector/J v5.0.3

 

If I change the return value of pay web method, then everything works. But I would like to have a String return type. Nothing else changes, but the web method is not working, throws an exception.

 

Thanks,

Gábor

 

 

The details:

 

1.a.: The web method code:

- - - - - - - - - - - - - - - - - - - - - - - - - - - service code - - - - - - - - - - - - - - - - - - - - - - - - - - -

            public String pay(Payment[] transactions) throws Exception

            {

                        String ret = "";

                       

                        for(int i = 0; i <= transactions.length; i++)

                        {

                                   //System.err.println("a(z) " + i + "-ik név = " + transactions[i].getName());

                                  

                                   Context initContext = new InitialContext();

                                   if ( initContext == null )

                                               ret += "no init context; ";

                                  

                                   Context envContext = (Context)initContext.lookup("java:/comp/env");

                                   if ( envContext == null )

                                               ret += "no enc context; ";

                                  

                                   DataSource ds = (DataSource)envContext.lookup("jdbc/TestDB");

                                   if ( ds == null )

                                               ret += "no datasource; ";

                                                                      

                                   Connection conn = ds.getConnection();

                                   if (conn == null )

                                               ret += "no conncetion; ";

                       

                                   Statement ins = conn.createStatement();

                                   ins.execute("insert into w(name) values('" + transactions[i].getName() + "')");

                       

                                   conn.commit();

                                   conn.close();

                        }

                       

                        return ret;

            }

- - - - - - - - - - - - - - - - - - - - - - - - - - - service code - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

1.b.: Payment class java

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - Payment java class code - - - - - - - - - - - - - - - - - - - - - - - - - - -

public class Payment

{

            private String m_Name;

            private int m_Amount;

                       

            public String getName()

            {

                        return m_Name;

            }

           

            public void setName(String value)

            {

                        m_Name = value;

            }

           

            public int getAmount()

            {

                        return m_Amount;

            }

           

            public void setAmount(int value)

            {

                        m_Amount = value;

            }

           

            public Payment(String name, int amount)

            {

                        m_Name = name;

                        m_Amount = amount;

            }

}

- - - - - - - - - - - - - - - - - - - - - - - - - - - Payment java class code - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

2.: Services.xml

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - services.xml- - - - - - - - - - - - - - - - - - - - - - - - - - -

<service name="wsTeszt">

    <description>Proba service.</description>

    <parameter name="ServiceClass" locked="false">wsteszt.ws</parameter>

    <operation name="hello">

        <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>

    </operation>

    <operation name="pay">

        <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>

    </operation>

</service>

- - - - - - - - - - - - - - - - - - - - - - - - - - - services.xml- - - - - - - - - - - - - - - - - - - - - - - - - - -

 

3.: I used the wsdl2java util to generate the stub:

 

wsdl2java -uri http://localhost:8080/axis2/services/ws?wsdl

 

4.: The test code:

- - - - - - - - - - - - - - - - - - - - - - - - - - - test code - - - - - - - - - - - - - - - - - - - - - - - - - - -

                        Pay tomb = new Pay();

                       

                        Payment p1 = new Payment();

                        p1.setName("name1");

                        p1.setAmount(5);

                        tomb.addParam0(p1);

 

                        Payment p2 = new Payment();

                        p2.setName("name2");

                        p2.setAmount(6);

                        tomb.addParam0(p2);

                       

                        //ws.pay(tomb);

                        PayResponse rr = ws.pay(tomb);

                       

                        System.out.println(rr.get_return());

- - - - - - - - - - - - - - - - - - - - - - - - - - - test code - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

5.: It throws an Exception:

- - - - - - - - - - - - - - - - - - - - - - - - - - - exception  - - - - - - - - - - - - - - - - - - - - - - - - - - -

Exception in thread "main" org.apache.axis2.AxisFault: InstantiationException : java.lang.InstantiationException: wsteszt.Payment

            at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:287)

            at org.apache.axis2.WsStub.pay(WsStub.java:146)

            at m.main(m.java:33)

Caused by: java.lang.Exception: org.apache.axis2.AxisFault: InstantiationException : java.lang.InstantiationException: wsteszt.Payment

            at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:226)

            at org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:440)

            at org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:380)

            at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:359)

            at org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:82)

            at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:103)

            at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)

            at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)

            at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)

            at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:136)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

            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.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:869)

            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)

            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

            at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

            at java.lang.Thread.run(Unknown Source)

 

            at org.apache.axis2.AxisFault.<init>(AxisFault.java:159)

            ... 3 more

- - - - - - - - - - - - - - - - - - - - - - - - - - - exception  - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

  • Axis2 RPC bug Prótár Gábor
    • RE: Axis2 RPC bug Prótár Gábor

Reply via email to