how to enable mapping for methods of return type *void*

View: New views
3 Messages — Rating Filter:   Alert me  

how to enable mapping for methods of return type *void*

by ajay.aggarwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

 

I am new to this library. I am using version 3.1.2

 

Some methods in my class implementing RPC are of return type VOID. I am
not able to call these methods from my test client. Other methods where
return type is not void are working fine. The error that I see both on
the server side as well as client side is "No such handler". I have
tried explicitly using the method "setVoidMethodEnabled(true)" on
PropertyHandlerMapping on my XmlRpcServer instance. Is this not the
right way to enable mapping for void return type methods?

 

 

The error that I get on the server is

SEVERE: No such handler: pool.join

     [java] org.apache.xmlrpc.server.XmlRpcNoSuchHandlerException: No
such handler: pool.join

     [java]     at
org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.getHandler(Abs
tractReflectiveHandlerMapping.java:214)

     [java]     at
org.apache.xmlrpc.server.XmlRpcServerWorker.execute(XmlRpcServerWorker.j
ava:45)

     [java]     at
org.apache.xmlrpc.server.XmlRpcServer.execute(XmlRpcServer.java:86)

     [java]     at
org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.j
ava:200)

     [java]     at
org.apache.xmlrpc.webserver.Connection.run(Connection.java:208)

     [java]     at
org.apache.xmlrpc.util.ThreadPool$Poolable$1.run(ThreadPool.java:68)

 

And the code that I am using to implement my server is as follows:

 

        WebServer webServer = new WebServer(port);

        XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();

       

        PropertyHandlerMapping phm = new PropertyHandlerMapping();

       

        phm.load(Thread.currentThread().getContextClassLoader(),

                 "XmlRpcServlet.properties");

 

        phm.setVoidMethodEnabled(true);

        xmlRpcServer.setHandlerMapping(phm);

     

        XmlRpcServerConfigImpl serverConfig =

            (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();

        serverConfig.setEnabledForExtensions(true);

        serverConfig.setContentLengthOptional(false);

 

        webServer.start();


Re: how to enable mapping for methods of return type *void*

by Jochen Wiedmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jun 30, 2009 at 8:33 PM, Aggarwal,
Ajay<Ajay.Aggarwal@...> wrote:

> Some methods in my class implementing RPC are of return type VOID.

That works only, if

a) both client and server are written in Apache XML-RPC and
b) you are enabling extensions on both and
c) you are enabling void methods on both

Jochen




--
Don't trust a government that doesn't trust you.

RE: how to enable mapping for methods of return type *void*

by ajay.aggarwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks. I figured out what I was doing wrong.

I needed to first enable void methods

        phm.setVoidMethodEnabled(true);

And then load the mappings

        phm.load(...., "XmlRpcServlet.properties");


I was doing it the other way round.

-Ajay


-----Original Message-----
From: Jochen Wiedmann [mailto:jochen.wiedmann@...]
Sent: Wednesday, July 01, 2009 11:04 AM
To: xmlrpc-dev@...
Subject: Re: how to enable mapping for methods of return type *void*

On Tue, Jun 30, 2009 at 8:33 PM, Aggarwal,
Ajay<Ajay.Aggarwal@...> wrote:

> Some methods in my class implementing RPC are of return type VOID.

That works only, if

a) both client and server are written in Apache XML-RPC and
b) you are enabling extensions on both and
c) you are enabling void methods on both

Jochen




--
Don't trust a government that doesn't trust you.