[Zope-Perl] more disruption

Martijn Pieters mj@digicool.com
Tue, 17 Oct 2000 21:36:48 +0200


On Mon, Oct 16, 2000 at 05:05:16PM -0700, Michel Pelletier wrote:
>       In Java::
> 
>         try
>         {
>             RPCClient rpc = new RPCClient();
>             rpc.setServer("betty.userland.com");
>             rpc.setPort(80);
>             rpc.setProcedureName("JanitorialDepartment.personnel");
>             Array employeeIds  = (Array) rpc.executeRPC();
>         }
>         catch (RPCException ex)
>         {
>             ex.printStackTrace();
>         }

Using package helma.xmlrpc (http://classic.helma.at/hannes/xmlrpc/), out
of the top of my head this would be:

    try {
        XmlRpcClient server = new XmlRpcClient("http://www.zopezoo.org/");
        Vector employees = (Vector) server.execute("JanitorialDepartment.personnel");
    
        int num = employees.size();
        for (int i = 0; i < num; i++) {
            Vector args = new Vector(employees.subList(i, i+1));
            server.execute("fireEmployee", args);
        }
        
    } catch (XmlRpcException ex) {
        ex.printStackTrace();
    } catch (IOException ioex) {
        ex.printStackTrace();
    }
    
All of this untested of course. 

-- 
Martijn Pieters
| Software Engineer  mailto:mj@digicool.com
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------