xml_rpc 0.1.4 xml_rpc: ^0.1.4 copied to clipboard
A library to communicate through the XML-RPC protocol.
xml_rpc #
A library to communicate through the XML-RPC protocol.
Usage #
A simple usage example:
import 'package:xml_rpc/client.dart' as xml_rpc;
main() {
final url = '...';
xml_rpc
.call(url, 'examples.getStateName', [41])
.then((result) => print(result))
.catchError((error) => print(error));
}
It will sent the following xml content:
<?xml version="1.0"?>
<methodCall>
<methodName>examples.getStateName</methodName>
<params>
<param>
<value><i4>41</i4></value>
</param>
</params>
</methodCall>
Every xmlrpc call has to be done with the call(...)
function. You must give
the url, the method name and the parameters. This function returns a Future
with the result received. If the response contains a <fault>
a Fault
object is
thrown and can be catch with the .catchError()
on the Future
.
To use this package from browser you can provide as client
optional named
argument on call
a http.BrowserClient
.
Parameter types #
Here are the conversion table.
xmlrpc | Dart |
---|---|
<int> or <i4> |
int |
<boolean> |
bool |
<string> or Text |
String |
<double> |
double |
<dateTime.iso8601> |
DateTime |
<base64> |
Base64Value |
<struct> |
Map<String, dynamic> |
<array> |
List |
Features and bugs #
Please file feature requests and bugs at the issue tracker.