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
35 example:
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
44 outgoing 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 username
58 Sets the username for basic authentication. If this is not set,
59 basic authentication will be disabled.
60
61 password
62 Sets the password for basic authentication.
63
64 debug
65 If set to a non-zero value will print the encoded XML request
66 and the XML response received.
67
68 call($method, @args)
69 Forward a procedure call to the server, either returning the value
70 returned by the procedure or failing with exception. `$method' is
71 the name of the server method, and `@args' is a list of arguments
72 to pass. Arguments may be Perl hashes, arrays, scalar values, or
73 the XML-RPC special data types below.
74
75 boolean( $value )
76 date_time( $value )
77 base64( $base64 )
78 The methods `boolean()', `date_time()', and `base64()' create and
79 return XML-RPC-specific datatypes that can be passed to `call()'.
80 Results from servers may also contain these datatypes. The
81 corresponding package names (for use with `ref()', for example) are
82 `"Frontier::RPC2::Boolean"', `"Frontier::RPC2::DateTime::ISO8601"',
83 and `"Frontier::RPC2::Base64"'.
84
85 The value of boolean, date/time, and base64 data can be set or
86 returned using the `value()' method. For example:
87
88 # To set a value:
89 $a_boolean->value(1);
90
91 # To retrieve a value
92 $base64 = $base64_xml_rpc_data->value();
93
94 Note: `base64()' does not encode or decode base64 data for you, you
95 must use MIME::Base64 or similar module for that.
96
97 int( 42 );
98 float( 3.14159 );
99 string( "Foo" );
100 By default, you may pass ordinary Perl values (scalars) to be
101 encoded. RPC2 automatically converts them to XML-RPC types if they
102 look like an integer, float, or as a string. This assumption
103 causes problems when you want to pass a string that looks like
104 "0096", RPC2 will convert that to an <i4> because it looks like an
105 integer. With these methods, you could now create a string object
106 like this:
107
108 $part_num = $server->string("0096");
109
110 and be confident that it will be passed as an XML-RPC string. You
111 can change and retrieve values from objects using value() as
112 described above.
113
115 perl(1), Frontier::RPC2(3)
116
117 <http://www.scripting.com/frontier5/xml/code/rpc.html>
118
120 Ken MacLeod <ken@bitsko.slc.ut.us> Basic authentication patch by Jeff
121 <jeff@freemedsoftware.org>
122
123
124
125perl v5.38.0 2023-07-20 Frontier::Client(3)