nsIXmlRpcClient

by 2 contributors:

 

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Warning: This interface was removed from Firefox 3 and is no longer available.

Please add a summary to this article.
  Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Inherits from: nsISupports

Method overview

void init(in string serverURL);
void setAuthentication(in string username, in string password);
void clearAuthentication(in string username, in string password);
void setEncoding(in string encoding);
void setEncoding(in unsigned long type, out nsIIDRef uuid, out nsQIResult result);
void asyncCall (in nsIXmlRpcClientListener listener, in nsISupports ctxt, in string methodName, in nsISupports arguments, in PRUInt32 count);

Attributes

Attribute Type Description
serverURL readonly nsIURL The URL of the XML-RPC server
inProgress readonly boolean Whether or not a call is in progress
fault readonly nsIXmlRpcFault The most recent XML-RPC fault from returned from this server. null if the last call didn't return an XML-RPC fault.
result readonly nsISupports The most recent XML-RPC call result returned from this server. null if the last call didn't return a valid result.
responseStatus readonly unsigned long The most recent HTTP status code returned from this server. null if the server was unreachable or not yet contacted.
responseString readonly unsigned long The most recent HTTP status code returned from this server. null if the server was unreachable or not yet contacted.

Constants

Constant Type Description
INT unsigned long nsISupportsPRInt32
BOOLEAN unsigned long nsISupportsPRBool
STRING unsigned long nsISupportsCString
DOUBLE unsigned long nsISupportsDouble
DATETIME unsigned long nsISupportsPRTime
ARRAY readonly unsigned long nsISupportsArray
STRUCT readonly unsigned long nsISupportsDictionary

Methods

init()

Set server URL. Call this before using this object

  void getData ( 
     in string serverURL
  ) ;
Parameters
serverURL
URL of server side object on which methods should be called

setAuthentication()

Set authentication info if needed. Both parameters must be specified for authentication to be enabled

  void setAuthentication ( 
     in string username,
     in string password 
  ) ;
Parameters
username
username to be used if asked to authenticate
password
password to be used if asked to authenticate

clearAuthentication()

Clear authentication info

  void setAuthentication ( 
     in string username,
     in string password 
  ) ;
Parameters
username

password

setEncoding()

Set character encoding. The default charset if this function is not called is "UTF-8"

  void setAuthentication ( 
     in string encoding
  ) ;
Parameters
encoding
encoding charset to be used

asyncCall()

Call remote method methodName asynchronously with given arguments.

Supported arguments are: nsISupportsPRUint8, nsISupportsPRUint16, nsISupportsPRInt16, nsISupportsPRInt32: i4, nsISupportsPRBool: boolean, nsISupportsChar, nsISupportsCString: string, nsISupportsFloat, nsISupportsDouble: double, nsISupportsPRTime: dateTime.iso8601, nsIInputStream: base64, nsISupportsArray: array, nsIDictionary: struct

Note that both nsISupportsArray and nsIDictionary can only hold any of the supported input types.

Return value will be converted as follows: i4 or int: nsISupportsPRInt32 boolean: nsISupportsPRBool string: nsISupportsCString double: nsISupportsDouble dateTime.iso8601: nsISupportsPRTime base64: nsISupportsCString array: nsISupportsArray struct: nsIDictionary

Faults (server side errors) are indicated by returning NS_ERROR_FAILURE. Via nsIXPConnect::GetPendingException()->data a nsIXmlRpcFault object can be retreieved with more information on the fault.

Parameters
listener
A nsIXmlRpcClientListener that will get notified of XML-RPC events
ctxt
A context to be passed on to the listener
methodName
Remote method to call
arguments
Array of arguments to pass to the remote method
count

  void asyncCall (
     in nsIXmlRpcClientListener listener,
     in nsISupports ctxt,
     in string methodName,
     [array, size_is(count)] in nsISupports arguments,
     in PRUint32 count
  );

createType()

Convenience: return the correct nsISupportsPrimitive for a given XML-RPC type, or nsISupportsArray or nsIDictionary. 'base64' isn't supported. No QueryInterface call is needed, the object has been QueryInterfaced to the correct interface.

  void createType ( 
     in unsigned long type, 
     out nsIIDRef uuid, 
     [iid_is(uuid),retval] out nsQIResult result
  ) ;
Parameters
type
One of the listed constants.
uuid
The uuid of the returned object. No QI call needed.
result
The appropriate XPCOM object.

Document Tags and Contributors

Contributors to this page: Sheppy, Graememcc
Last updated by: Sheppy,