public class XmlRpcServer
extends java.lang.Object
The XmlRpcServer may also be started as a service accepting connections on a given port. This way, a servlet environment is not required to be able to expose XML-RPC services. The server acts as a minimal HTTP server accepting text/xml posts containing XML-RPC messages, only.
For further information on setting up an XML-RPC server, see the documentation.
Note that a current limitation of the server prevents invocation handlers, invocation processors, and invocation handler aliases to be added after the server is running. Access to these collections has not been synchronized
| Constructor and Description |
|---|
XmlRpcServer() |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
execute(java.io.InputStream xmlInput)
Dispatches the call contained in the supplied input stream.
|
java.lang.String |
getInvocationHandlerAlias(java.lang.String alias)
Returns the alias mapping for the supplied alias, or null, if
the alias is not registered.
|
XmlRpcInvocationProcessor |
getInvocationProcessor(int index)
|
int |
getInvocationProcessorCount()
Returns the number of invocation processors registered in the server.
|
void |
registerInvocationHandler(java.lang.String name,
XmlRpcInvocationHandler handler)
Binds an invocation handler object to the given name.
|
void |
registerInvocationHandlerAlias(java.lang.String alias,
java.lang.String mapping)
Binds an invocation handler object to the given name.
|
void |
registerInvocationProcessor(XmlRpcInvocationProcessor processor)
Invocation processors are invoked on every call, regardless of which handler or
method the call is intended for.
|
void |
registerProxyService(java.lang.Object service)
Registers a service that is used by a dynamic proxy created by
XmlRpcProxy.
|
void |
registerProxyService(java.lang.Object service,
java.lang.String name)
Registers a service that is used by a dynamic proxy created by
XmlRpcProxy.
|
void |
runAsService(int port)
Starts the XmlRpcServer object as a service accepting inbound HTTP connections on
the given port.
|
void |
unregisterInvocationHandler(java.lang.String name)
Unbinds a previously bound invocation handler.
|
void |
unregisterInvocationHandlerAlias(java.lang.String alias)
Unbinds a previously bound invocation handler.
|
void |
unregisterInvocationProcessor(XmlRpcInvocationProcessor processor)
Removes a previously registered invocation processor.
|
public void runAsService(int port)
throws java.io.IOException
port - The port number to be used for inbound connections.java.io.IOException - if a socket error occurs.public byte[] execute(java.io.InputStream xmlInput)
throws java.lang.Throwable
xmlInput - The XML-RPC message.java.lang.Throwable - if the input stream contains unparseable XML or if some error
occurs in the SAX driver.public void registerInvocationHandler(java.lang.String name,
XmlRpcInvocationHandler handler)
name - The name to bind the handler to.handler - The invocation handler object.public void unregisterInvocationHandler(java.lang.String name)
name - The name of the handler to unbind.public void registerInvocationHandlerAlias(java.lang.String alias,
java.lang.String mapping)
name - The name to bind the handler to.handler - The invocation handler object.public void unregisterInvocationHandlerAlias(java.lang.String alias)
name - The name of the handler to unbind.public java.lang.String getInvocationHandlerAlias(java.lang.String alias)
alias - public void registerInvocationProcessor(XmlRpcInvocationProcessor processor)
processor - An invocation processor that will be invoked on every call
sent to this server.public void unregisterInvocationProcessor(XmlRpcInvocationProcessor processor)
processor - The invocation processor to removepublic int getInvocationProcessorCount()
public XmlRpcInvocationProcessor getInvocationProcessor(int index)
index - public void registerProxyService(java.lang.Object service)
Object - service the object that exposes methods to XmlRpc clientspublic void registerProxyService(java.lang.Object service,
java.lang.String name)
service - the object that exposes methods to XmlRpc
clientsname - the name under which the service will be
registered