public class XMLRPCClient
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
FLAGS_8BYTE_INT
The client will be able to handle 8 byte integer values (longs).
|
static int |
FLAGS_APACHE_WS
This flag should be used if the server is an apache ws xmlrpc server.
|
static int |
FLAGS_DEFAULT_TYPE_STRING
With this flag enabled, a value with a missing type tag, will be parsed
as a string element.
|
static int |
FLAGS_ENABLE_COOKIES
With this flag, the client will be able to handle cookies, meaning saving cookies
from the server and sending it with every other request again.
|
static int |
FLAGS_FORWARD
With this flag enabled, the client will forward the request, if
the 301 or 302 HTTP status code has been received.
|
static int |
FLAGS_IGNORE_NAMESPACES
With this flag enabled, the
XMLRPCClient ignores all namespaces
used within the response from the server. |
static int |
FLAGS_IGNORE_STATUSCODE
With this flag enabled, the XML-RPC client will ignore the HTTP status
code of the response from the server.
|
static int |
FLAGS_NIL
The client will be able to send null values.
|
static int |
FLAGS_NO_STRING_DECODE
This prevents the decoding of incoming strings, meaning & and <
won't be decoded to the & sign and the "less then" sign.
|
static int |
FLAGS_NO_STRING_ENCODE
By default outgoing string values will be encoded according to specification.
|
static int |
FLAGS_NONE
No flags should be set.
|
static int |
FLAGS_SSL_IGNORE_ERRORS
This flag disables all SSL warnings.
|
static int |
FLAGS_SSL_IGNORE_INVALID_CERT
With this flag enabled, the client will ignore all unverified SSL/TLS
certificates.
|
static int |
FLAGS_SSL_IGNORE_INVALID_HOST
With this flag enabled, the client will ignore, if the URL doesn't match
the SSL Certificate.
|
static int |
FLAGS_STRICT
The client should parse responses strict to specification.
|
static int |
FLAGS_USE_SYSTEM_PROXY
With this flag enabled, the
XMLRPCClient will use the system http
proxy to connect to the XML-RPC server. |
static java.lang.String |
VALUE |
| Constructor and Description |
|---|
XMLRPCClient(java.net.URL url)
Create a new XMLRPC client for the given url.
|
XMLRPCClient(java.net.URL url,
int flags)
Create a new XMLRPC client for the given URL.
|
XMLRPCClient(java.net.URL url,
java.lang.String userAgent)
Create a new XMLRPC client for the given url.
|
XMLRPCClient(java.net.URL url,
java.lang.String userAgent,
int flags)
Create a new XMLRPC client for the given URL.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
call(java.lang.String method,
java.lang.Object... params)
Call a remote procedure on the server.
|
long |
callAsync(XMLRPCCallback listener,
java.lang.String methodName,
java.lang.Object... params)
Asynchronously call a remote procedure on the server.
|
void |
cancel(long id)
Cancel a specific asynchronous call.
|
void |
clearCookies()
Delete all cookies currently used by the client.
|
void |
clearLoginData()
Clear the username and password.
|
java.util.Map<java.lang.String,java.lang.String> |
getCookies()
Returns a
Map of all cookies. |
java.net.URL |
getURL()
Returns the URL this XMLRPCClient is connected to.
|
void |
installCustomKeyManager(javax.net.ssl.KeyManager keyManager)
Installs a custom
KeyManager to handle SSL/TLS certificate verification. |
void |
installCustomKeyManagers(javax.net.ssl.KeyManager[] keyManagers)
Installs custom
KeyManagers to handle SSL/TLS certificate
verification. |
void |
installCustomTrustManager(javax.net.ssl.TrustManager trustManager)
Installs a custom
TrustManager to handle SSL/TLS certificate verification. |
void |
installCustomTrustManagers(javax.net.ssl.TrustManager[] trustManagers)
Installs custom
TrustManagers to handle SSL/TLS certificate
verification. |
void |
setCustomHttpHeader(java.lang.String headerName,
java.lang.String headerValue)
Set a HTTP header field to a custom value.
|
void |
setLoginData(java.lang.String user,
java.lang.String pass)
Set the username and password that should be used to perform basic
http authentication.
|
void |
setProxy(java.net.Proxy proxy)
Sets a proxy to use for this client.
|
void |
setTimeout(int timeout)
Sets the time in seconds after which a call should timeout.
|
void |
setUserAgentString(java.lang.String userAgent)
Sets the user agent string.
|
public static final java.lang.String VALUE
public static final int FLAGS_NONE
public static final int FLAGS_STRICT
public static final int FLAGS_8BYTE_INT
public static final int FLAGS_ENABLE_COOKIES
public static final int FLAGS_NIL
public static final int FLAGS_IGNORE_STATUSCODE
public static final int FLAGS_FORWARD
public static final int FLAGS_SSL_IGNORE_INVALID_HOST
public static final int FLAGS_SSL_IGNORE_INVALID_CERT
installCustomTrustManager(javax.net.ssl.TrustManager)
won't have any effect.public static final int FLAGS_DEFAULT_TYPE_STRING
public static final int FLAGS_IGNORE_NAMESPACES
XMLRPCClient ignores all namespaces
used within the response from the server.public static final int FLAGS_USE_SYSTEM_PROXY
XMLRPCClient will use the system http
proxy to connect to the XML-RPC server.public static final int FLAGS_NO_STRING_DECODE
FLAGS_NO_STRING_ENCODE for the counterpart.public static final int FLAGS_NO_STRING_ENCODE
FLAGS_NO_STRING_ENCODE for the counterpart.public static final int FLAGS_SSL_IGNORE_ERRORS
public static final int FLAGS_APACHE_WS
public XMLRPCClient(java.net.URL url,
java.lang.String userAgent,
int flags)
url - The URL to send the requests to.userAgent - A user agent string to use in the HTTP requests.flags - A combination of flags to be set.public XMLRPCClient(java.net.URL url,
int flags)
url - The URL to send the requests to.flags - A combination of flags to be set.public XMLRPCClient(java.net.URL url,
java.lang.String userAgent)
url - The url to send the requests to.userAgent - A user agent string to use in the http request.public XMLRPCClient(java.net.URL url)
url - The url to send the requests to.public java.net.URL getURL()
public void setTimeout(int timeout)
timeout will be zero or less the connection will never timeout.
In case the connection times out and XMLRPCTimeoutException will
be thrown for calls made by call(java.lang.String, java.lang.Object[]).
For calls made by callAsync(de.timroes.axmlrpc.XMLRPCCallback, java.lang.String, java.lang.Object[])
the XMLRPCCallback.onError(long, de.timroes.axmlrpc.XMLRPCException) method
of the callback will be called. By default connections won't timeout.timeout - The timeout for connections in seconds.public void setUserAgentString(java.lang.String userAgent)
userAgent - The new user agent string.public void setProxy(java.net.Proxy proxy)
#FLAGS_adbUSE_SYSTEM_PROXY instead. If combined with
FLAGS_USE_SYSTEM_PROXY, this proxy will be used instead of the
system proxy.proxy - A proxy to use for the connection.public void setCustomHttpHeader(java.lang.String headerName,
java.lang.String headerValue)
headerName - The name of the header field.headerValue - The new value of the header field.public void setLoginData(java.lang.String user,
java.lang.String pass)
user - Usernamepass - Passwordpublic void clearLoginData()
public java.util.Map<java.lang.String,java.lang.String> getCookies()
Map of all cookies. It contains each cookie key as a map
key and its value as a map value. Cookies will only be used if FLAGS_ENABLE_COOKIES
has been set for the client. This map will also be available (and empty)
when this flag hasn't been said, but has no effect on the HTTP connection.Map of all cookies.public void clearCookies()
public void installCustomTrustManager(javax.net.ssl.TrustManager trustManager)
TrustManager to handle SSL/TLS certificate verification.
This will replace any previously installed TrustManagers.
If FLAGS_SSL_IGNORE_INVALID_CERT is set, this won't do anything.trustManager - TrustManager to install.installCustomTrustManagers(javax.net.ssl.TrustManager[])public void installCustomTrustManagers(javax.net.ssl.TrustManager[] trustManagers)
TrustManagers to handle SSL/TLS certificate
verification. This will replace any previously installed TrustManagerss.
If FLAGS_SSL_IGNORE_INVALID_CERT is set, this won't do anything.trustManagers - TrustManagers to install.installCustomTrustManager(javax.net.ssl.TrustManager)public void installCustomKeyManager(javax.net.ssl.KeyManager keyManager)
KeyManager to handle SSL/TLS certificate verification.
This will replace any previously installed KeyManagers.
If FLAGS_SSL_IGNORE_INVALID_CERT is set, this won't do anything.keyManager - KeyManager to install.installCustomKeyManagers(javax.net.ssl.KeyManager[])public void installCustomKeyManagers(javax.net.ssl.KeyManager[] keyManagers)
KeyManagers to handle SSL/TLS certificate
verification. This will replace any previously installed KeyManagerss.
If FLAGS_SSL_IGNORE_INVALID_CERT is set, this won't do anything.keyManagers - KeyManagers to install.installCustomKeyManager(javax.net.ssl.KeyManager)public java.lang.Object call(java.lang.String method,
java.lang.Object... params)
throws XMLRPCException
method - A method name to call.params - An array of parameters for the method.XMLRPCException - Will be thrown if an error occurred during the call.public long callAsync(XMLRPCCallback listener, java.lang.String methodName, java.lang.Object... params)
listener - A listener, which will be notified about the server response or errors.methodName - A method name to call on the server.params - An array of parameters for the method.public void cancel(long id)
id - The id of the call as returned by the callAsync method.