org.apache.xmlrpc
Class XmlRpcClient

java.lang.Object
  |
  +--org.apache.xmlrpc.XmlRpcClient
All Implemented Interfaces:
XmlRpcHandler
Direct Known Subclasses:
SecureXmlRpcClient, XmlRpcClientLite

public class XmlRpcClient
extends java.lang.Object
implements XmlRpcHandler

A multithreaded, reusable XML-RPC client object. Use this if you need a full-grown HTTP client (e.g. for Proxy and Basic Auth support). If you don't need that, XmlRpcClientLite may work better for you.

Version:
$Id: XmlRpcClient.java,v 1.14 2002/11/21 01:28:16 dlr Exp $
Author:
Hannes Wallnoefer

Field Summary
protected  int asyncWorkers
           
protected  java.util.Stack pool
           
protected  java.net.URL url
           
protected  int workers
           
 
Constructor Summary
XmlRpcClient(java.lang.String url)
          Construct a XML-RPC client for the URL represented by this String.
XmlRpcClient(java.lang.String hostname, int port)
          Construct a XML-RPC client for the specified hostname and port.
XmlRpcClient(java.net.URL url)
          Construct a XML-RPC client with this URL.
 
Method Summary
 java.lang.Object execute(java.lang.String method, java.util.Vector params)
          Generate an XML-RPC request and send it to the server.
 void executeAsync(java.lang.String method, java.util.Vector params, AsyncCallback callback)
          Generate an XML-RPC request and send it to the server in a new thread.
 java.net.URL getURL()
          Return the URL for this XML-RPC client.
static void main(java.lang.String[] args)
          Just for testing.
 void setBasicAuthentication(java.lang.String user, java.lang.String password)
          Sets Authentication for this client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

protected java.net.URL url

pool

protected java.util.Stack pool

workers

protected int workers

asyncWorkers

protected int asyncWorkers
Constructor Detail

XmlRpcClient

public XmlRpcClient(java.net.URL url)
Construct a XML-RPC client with this URL.

XmlRpcClient

public XmlRpcClient(java.lang.String url)
             throws java.net.MalformedURLException
Construct a XML-RPC client for the URL represented by this String.

XmlRpcClient

public XmlRpcClient(java.lang.String hostname,
                    int port)
             throws java.net.MalformedURLException
Construct a XML-RPC client for the specified hostname and port.
Method Detail

getURL

public java.net.URL getURL()
Return the URL for this XML-RPC client.

setBasicAuthentication

public void setBasicAuthentication(java.lang.String user,
                                   java.lang.String password)
Sets Authentication for this client. This will be sent as Basic Authentication header to the server as described in http://www.ietf.org/rfc/rfc2617.txt.

execute

public java.lang.Object execute(java.lang.String method,
                                java.util.Vector params)
                         throws XmlRpcException,
                                java.io.IOException
Generate an XML-RPC request and send it to the server. Parse the result and return the corresponding Java object.
Specified by:
execute in interface XmlRpcHandler
Throws:
XmlRpcException: - If the remote host returned a fault message.
IOException: - If the call could not be made because of lower level problems.

executeAsync

public void executeAsync(java.lang.String method,
                         java.util.Vector params,
                         AsyncCallback callback)
Generate an XML-RPC request and send it to the server in a new thread. This method returns immediately. If the callback parameter is not null, it will be called later to handle the result or error when the call is finished.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Just for testing.


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.