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 Cookies support). If you don't need that, XmlRpcClientLite may work better for you.

Author:
Hannes Wallnoefer

Inner Class Summary
(package private)  class XmlRpcClient.CallData
           
(package private)  class XmlRpcClient.Worker
           
 
Field Summary
protected  int asyncWorkers
           
private  java.lang.String auth
           
private  XmlRpcClient.CallData first
           
private  XmlRpcClient.CallData last
           
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
(package private)  XmlRpcClient.CallData dequeue()
           
(package private)  void enqueue(java.lang.String method, java.util.Vector params, AsyncCallback callback)
           
 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.
(package private)  XmlRpcClient.Worker getWorker(boolean async)
           
static void main(java.lang.String[] args)
          Just for testing.
(package private)  void releaseWorker(XmlRpcClient.Worker w, boolean async)
          Release possibly big per-call object references to allow them to be garbage collected
 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, registerNatives, toString, wait, wait, wait
 

Field Detail

url

protected java.net.URL url

auth

private java.lang.String auth

pool

protected java.util.Stack pool

workers

protected int workers

asyncWorkers

protected int asyncWorkers

first

private XmlRpcClient.CallData first

last

private XmlRpcClient.CallData last
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.

getWorker

XmlRpcClient.Worker getWorker(boolean async)
                        throws java.io.IOException

releaseWorker

void releaseWorker(XmlRpcClient.Worker w,
                   boolean async)
Release possibly big per-call object references to allow them to be garbage collected

enqueue

void enqueue(java.lang.String method,
             java.util.Vector params,
             AsyncCallback callback)

dequeue

XmlRpcClient.CallData dequeue()

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.