Package totalcross.xml.rpc
Class XmlRpcClient
- java.lang.Object
-
- totalcross.xml.XmlTokenizer
-
- totalcross.xml.XmlReader
-
- totalcross.xml.rpc.XmlRpcClient
-
public class XmlRpcClient extends XmlReader
Handles XML-RPCs to a server. This object cannot be reused.
-
-
Field Summary
Fields Modifier and Type Field Description protected XmlRpcContentHandlerxmlHandler-
Fields inherited from class totalcross.xml.XmlReader
tagName, tagNameHashId
-
-
Constructor Summary
Constructors Constructor Description XmlRpcClient(java.lang.String hostname, int port, java.lang.String uri)XmlRpcClient(java.lang.String hostname, int port, java.lang.String uri, boolean doCompression)Creates a xmlrpc client with compression if the given flag is true.XmlRpcClient(java.lang.String hostname, int port, java.lang.String uri, int openTimeout, int readTimeout, int writeTimeout, boolean doCompression)XmlRpcClient(StandardHttpClient httpClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectexecute(java.lang.String method, Vector params)Generates an XML-RPC request and sends it to the server.protected intgetTagCode(char[] c, int offset, int count)Method to compute the tag code identifying a tag name.protected voidwriteObject(java.lang.Object what)Writes the XML representation of a supported Java object to the XML writer.-
Methods inherited from class totalcross.xml.XmlReader
foundAttributeName, foundAttributeValue, foundCharacter, foundCharacterData, foundComment, foundDeclaration, foundEndEmptyTag, foundEndOfInput, foundEndTagName, foundStartTagName, getContentHandler, parse, parse, parse, parse, setAttributeListFilter, setCaseInsensitive, setContentHandler, setNewlineSignificant
-
Methods inherited from class totalcross.xml.XmlTokenizer
disableReferenceResolution, foundInvalidData, foundProcessingInstruction, foundReference, foundStartOfInput, getAbsoluteOffset, hashCode, isDataCDATA, resolveCharacterReference, setCdataContents, setStrictlyXml, tokenize, tokenize, tokenize, tokenize
-
-
-
-
Field Detail
-
xmlHandler
protected XmlRpcContentHandler xmlHandler
-
-
Constructor Detail
-
XmlRpcClient
public XmlRpcClient(java.lang.String hostname, int port, java.lang.String uri) throws XmlRpcException, UnknownHostException- Parameters:
hostname- The server address to connect toport- The port on the server to connect touri- The connecting URI. Defaults to "/RPC2"- Throws:
XmlRpcException- If the connection to the server was unsuccessfulUnknownHostException
-
XmlRpcClient
public XmlRpcClient(java.lang.String hostname, int port, java.lang.String uri, boolean doCompression) throws XmlRpcException, UnknownHostExceptionCreates a xmlrpc client with compression if the given flag is true.- Throws:
XmlRpcExceptionUnknownHostException
-
XmlRpcClient
public XmlRpcClient(java.lang.String hostname, int port, java.lang.String uri, int openTimeout, int readTimeout, int writeTimeout, boolean doCompression) throws XmlRpcException, UnknownHostException- Throws:
XmlRpcExceptionUnknownHostException
-
XmlRpcClient
public XmlRpcClient(StandardHttpClient httpClient) throws XmlRpcException, UnknownHostException
- Throws:
XmlRpcExceptionUnknownHostException
-
-
Method Detail
-
execute
public java.lang.Object execute(java.lang.String method, Vector params) throws XmlRpcException, IOException, java.io.UnsupportedEncodingExceptionGenerates an XML-RPC request and sends it to the server. Parses the result and returns the corresponding Java object.- Parameters:
method- The remote procedure to callparams- The parameters to the correspondingmethod- Throws:
XmlRpcException- If the remote procedure call was unsuccessfulIOExceptionjava.io.UnsupportedEncodingException
-
getTagCode
protected int getTagCode(char[] c, int offset, int count)Description copied from class:XmlReaderMethod to compute the tag code identifying a tag name.This is the value which is passed to ContentHandler's for reporting a tag name. Derived class may override it. Impl Note: Transforming to uppercase takes into account that the bytes are in the range [0-9A-Za-z]: (ch >= 'a') means "ch is a lower case letter". Also, we *do* know that the count is > 0.
- Overrides:
getTagCodein classXmlReader- Parameters:
c- char array containing the bytes to be hashedoffset- position of the first char in the arraycount- number of chars to be hashed- Returns:
- the corresponding hash code
-
writeObject
protected void writeObject(java.lang.Object what)
Writes the XML representation of a supported Java object to the XML writer.- Parameters:
what- The object to write
-
-