com.flat502.rox.client
Class XmlRpcClient

java.lang.Object
  extended by com.flat502.rox.processing.HttpRpcProcessor
      extended by com.flat502.rox.client.HttpRpcClient
          extended by com.flat502.rox.client.XmlRpcClient

public class XmlRpcClient
extends HttpRpcClient

This is the client-side XML-RPC interface.

This is a specialization of the HttpRpcClient.

Typical synchronous usage of this class is illustrated in the following sample:

 XmlRpcClient client = new XmlRpcClient(new URL("http://localhost:8080/"));
 Object rsp = client.execute("math.increment", new Object[] { new Integer(42) });
 

Typical asynchronous usage of this class is illustrated in the following sample:

 public class OnceAsyncClient implements ResponseHandler {
        public static boolean done = false;
 
        public void handleResponse(XMLRPCMethodCall call, XMLRPCMethodResponse response) {
                System.out.println(response.getReturnValue());
                done = true;
        }

        public void handleException(XMLRPCMethodCall call, Exception e) {
                e.printStackTrace();
                done = true;
        }

        public static void main(String[] args) {
                try {
                        XMLRPCClient client = new XMLRPCClient(new URL("http://localhost:8080/"));
                        client.execute("math.increment", new Object[] { new Integer(42) }, new OnceAsyncClient());
                        while(!done) {
                                Thread.yield();
                        }
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
 }
 


Field Summary
 
Fields inherited from class com.flat502.rox.processing.HttpRpcProcessor
ALL_CIPHER_SUITES, ANON_CIPHER_SUITES
 
Constructor Summary
XmlRpcClient(java.net.URL url)
           
XmlRpcClient(java.net.URL url, ClientResourcePool workerPool)
           
XmlRpcClient(java.net.URL url, ClientResourcePool workerPool, SSLConfiguration sslCfg)
           
XmlRpcClient(java.net.URL url, SSLConfiguration sslCfg)
           
 
Method Summary
protected  MethodResponseUnmarshaller getMethodResponseUnmarshaller()
          Retrieves an MethodResponseUnmarshaller instance for unmarshalling incoming RpcResponses.
protected  RpcCall newRpcCall(java.lang.String name, java.lang.Object[] params)
           
 void setCompactXml(boolean compact)
          Configure the compactness of the marshalled form of this instance.
 void setFieldNameCodec(FieldNameCodec codec)
           
 void setUnmarshaller(MethodResponseUnmarshaller unmarshaller)
          Configure the MethodResponseUnmarshaller instance to use when unmarshalling incoming XML-RPC responses.
 
Methods inherited from class com.flat502.rox.client.HttpRpcClient
connect, deregisterChannel, execute, execute, execute, execute, execute, execute, execute, execute, execute, getReadBuffer, getUserAgent, getWriteBuffer, handleMessageException, handleProcessingException, handleSelectionKeyOperation, handleSSLHandshakeFinished, handleTimeout, initialize, initSocketSSLEngine, isWriteQueued, newHttpRequest, newRpcResponseContext, newWorkerPool, proxyObject, proxyObject, putWriteBuffer, registerChannel, removeReadBuffer, removeReadBuffers, removeWriteBuffer, removeWriteBuffers, setAcceptEncodedResponses, setConnectionPoolLimit, setConnectionPoolTimeout, setContentEncoding, setRequestTimeout, stopImpl, validateHttpResponse
 
Methods inherited from class com.flat502.rox.processing.HttpRpcProcessor
addWorker, addWorkers, deregisterSocket, getQueue, getSocketSelector, getSSLConfiguration, getSSLSession, getTimer, getWorkerCount, initSelector, isSharedWorkerPool, isStarted, newSSLSession, queueCancellation, queueRead, queueRegistration, queueWrite, queueWrite, read, registerProfiler, registerSocket, registerSSLSessionPolicy, removeWorker, setCipherSuitePattern, setSSLHandshakeTimeout, shouldUseHTTPS, start, stop, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRpcClient

public XmlRpcClient(java.net.URL url)
             throws java.io.IOException
Throws:
java.io.IOException

XmlRpcClient

public XmlRpcClient(java.net.URL url,
                    SSLConfiguration sslCfg)
             throws java.io.IOException
Throws:
java.io.IOException

XmlRpcClient

public XmlRpcClient(java.net.URL url,
                    ClientResourcePool workerPool)
             throws java.io.IOException
Throws:
java.io.IOException

XmlRpcClient

public XmlRpcClient(java.net.URL url,
                    ClientResourcePool workerPool,
                    SSLConfiguration sslCfg)
             throws java.io.IOException
Throws:
java.io.IOException
Method Detail

newRpcCall

protected RpcCall newRpcCall(java.lang.String name,
                             java.lang.Object[] params)
Specified by:
newRpcCall in class HttpRpcClient

setCompactXml

public void setCompactXml(boolean compact)
Configure the compactness of the marshalled form of this instance.

The marshalled form of instances is compact by default.

Parameters:
compact - A flag indicating whether to produce compact XML (true) or more readable XML (false).

setUnmarshaller

public void setUnmarshaller(MethodResponseUnmarshaller unmarshaller)
Configure the MethodResponseUnmarshaller instance to use when unmarshalling incoming XML-RPC responses.

Parameters:
unmarshaller - The new unmarshaller instance to use.
See Also:
TODO: Link to Sax unmarshaller

setFieldNameCodec

public void setFieldNameCodec(FieldNameCodec codec)

getMethodResponseUnmarshaller

protected MethodResponseUnmarshaller getMethodResponseUnmarshaller()
Description copied from class: HttpRpcClient
Retrieves an MethodResponseUnmarshaller instance for unmarshalling incoming RpcResponses.

Implementations may return the same unmarshaller instance for each call to this method as long as that unmarshaller is thread-safe.

Specified by:
getMethodResponseUnmarshaller in class HttpRpcClient
Returns:
An appropriately initialized unmarshaller.