nsIXmlRpcClient 编辑

 

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. extensions/xml-rpc/idl/nsIXmlRpcClient.idlScriptable 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

AttributeTypeDescription
serverURLreadonly nsIURLThe URL of the XML-RPC server
inProgressreadonly booleanWhether or not a call is in progress
faultreadonly nsIXmlRpcFaultThe most recent XML-RPC fault from returned from this server. null if the last call didn't return an XML-RPC fault.
resultreadonly nsISupportsThe most recent XML-RPC call result returned from this server. null if the last call didn't return a valid result.
responseStatusreadonly unsigned longThe most recent HTTP status code returned from this server. null if the server was unreachable or not yet contacted.
responseStringreadonly unsigned longThe most recent HTTP status code returned from this server. null if the server was unreachable or not yet contacted.

Constants

ConstantTypeDescription
INTunsigned longnsISupportsPRInt32
BOOLEANunsigned longnsISupportsPRBool
STRINGunsigned longnsISupportsCString
DOUBLEunsigned longnsISupportsDouble
DATETIMEunsigned longnsISupportsPRTime
ARRAYreadonly unsigned longnsISupportsArray
STRUCTreadonly unsigned longnsISupportsDictionary

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:42 次

字数:8886

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文