1Frontier::Client(3) User Contributed Perl Documentation Frontier::Client(3)
2
3
4
6 Frontier::Client - issue Frontier XML RPC requests to a server
7
9 use Frontier::Client;
10
11 $server = Frontier::Client->new( I<OPTIONS> );
12
13 $result = $server->call($method, @args);
14
15 $boolean = $server->boolean($value);
16 $date_time = $server->date_time($value);
17 $base64 = $server->base64($value);
18
19 $value = $boolean->value;
20 $value = $date_time->value;
21 $value = $base64->value;
22
24 Frontier::Client is an XML-RPC client over HTTP. Frontier::Client
25 instances are used to make calls to XML-RPC servers and as shortcuts
26 for creating XML-RPC special data types.
27
29 new( OPTIONS )
30 Returns a new instance of Frontier::Client and associates it with
31 an XML-RPC server at a URL. OPTIONS may be a list of key, value
32 pairs or a hash containing the following parameters:
33
34 url The URL of the server. This parameter is required. For exam‐
35 ple:
36
37 $server = Frontier::Client->new( 'url' => 'http://betty.userland.com/RPC2' );
38
39 proxy
40 A URL of a proxy to forward XML-RPC calls through.
41
42 encoding
43 The XML encoding to be specified in the XML declaration of out‐
44 going RPC requests. Incoming results may have a different
45 encoding specified; XML::Parser will convert incoming data to
46 UTF-8. The default outgoing encoding is none, which uses XML
47 1.0's default of UTF-8. For example:
48
49 $server = Frontier::Client->new( 'url' => 'http://betty.userland.com/RPC2',
50 'encoding' => 'ISO-8859-1' );
51
52 use_objects
53 If set to a non-zero value will convert incoming <i4>, <float>,
54 and <string> values to objects instead of scalars. See int(),
55 float(), and string() below for more details.
56
57 debug
58 If set to a non-zero value will print the encoded XML request
59 and the XML response received.
60
61 call($method, @args)
62 Forward a procedure call to the server, either returning the value
63 returned by the procedure or failing with exception. `$method' is
64 the name of the server method, and `@args' is a list of arguments
65 to pass. Arguments may be Perl hashes, arrays, scalar values, or
66 the XML-RPC special data types below.
67
68 boolean( $value )
69 date_time( $value )
70 base64( $base64 )
71 The methods `"boolean()"', `"date_time()"', and `"base64()"' create
72 and return XML-RPC-specific datatypes that can be passed to
73 `"call()"'. Results from servers may also contain these datatypes.
74 The corresponding package names (for use with `"ref()"', for exam‐
75 ple) are `"Frontier::RPC2::Boolean"', `"Frontier::RPC2::Date‐
76 Time::ISO8601"', and `"Frontier::RPC2::Base64"'.
77
78 The value of boolean, date/time, and base64 data can be set or
79 returned using the `"value()"' method. For example:
80
81 # To set a value:
82 $a_boolean->value(1);
83
84 # To retrieve a value
85 $base64 = $base64_xml_rpc_data->value();
86
87 Note: `"base64()"' does not encode or decode base64 data for you,
88 you must use MIME::Base64 or similar module for that.
89
90 int( 42 );
91 float( 3.14159 );
92 string( "Foo" );
93 By default, you may pass ordinary Perl values (scalars) to be
94 encoded. RPC2 automatically converts them to XML-RPC types if they
95 look like an integer, float, or as a string. This assumption
96 causes problems when you want to pass a string that looks like
97 "0096", RPC2 will convert that to an <i4> because it looks like an
98 integer. With these methods, you could now create a string object
99 like this:
100
101 $part_num = $server->string("0096");
102
103 and be confident that it will be passed as an XML-RPC string. You
104 can change and retrieve values from objects using value() as
105 described above.
106
108 perl(1), Frontier::RPC2(3)
109
110 <http://www.scripting.com/frontier5/xml/code/rpc.html>
111
113 Ken MacLeod <ken@bitsko.slc.ut.us>
114
115
116
117perl v5.8.8 2002-08-02 Frontier::Client(3)