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.
extensions/xml-rpc/idl/nsIXmlRpcClient.idl
Scriptable 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论