Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
XML::RPC(3) User Contributed Perl Documentation XML::RPC(3)

XML::RPC -- Pure Perl implementation for an XML-RPC client and server.

make a call to an XML-RPC server:
    use XML::RPC;
    my $xmlrpc = XML::RPC->new('');
    my $result = $xmlrpc->call( 'examples.getStateStruct', { state1 => 12, state2 => 28 } );
create an XML-RPC service:
    use XML::RPC;
    use CGI;
    my $q      = new CGI;
    my $xmlrpc = XML::RPC->new();
    my $xml    = $q->param('POSTDATA');
    print $q->header( -type => 'text/xml', -charset => 'UTF-8' );
    print $xmlrpc->receive( $xml, \&handler );
    sub handler {
        my ( $methodname, @params ) = @_;
        return { you_called => $methodname, with_params => \@params };

XML::RPC module provides simple Pure Perl methods for XML-RPC communication. It's goals are simplicity and flexibility. XML::RPC uses XML::TreePP for parsing.

This constructor method returns a new XML::RPC object. Usable for XML-RPC servers.

Its first argument is the full URL for your server. The second argument is for options passing to XML::TreePP, for example: output_encoding => 'ISO-8859-1' (default is UTF-8).

This method calls the provides XML-RPC server's method_name with @arguments. It will return the server method's response.

This parses an incoming XML-RPC methodCall and call the \&handler subref with parameters: $methodName and @parameters.

Returns the last XML that went in the client.

Returns the last XML that went out the client.

When passing a CODEREF to a value XML::RPC will simply use the returned hashref as a type => value pair.

To provide an error response you can simply die() in the \&handler function. Also you can set the $XML::RPC::faultCode variable to a (int) value just before dieing.

Default XML::RPC will try to use LWP::Useragent for requests, you can set the environment variable: CGI_HTTP_PROXY to set a proxy.

XML::RPC will not create "bool", "dateTime.iso8601" or "base64" types automatically. They will be parsed as "int" or "string". You can use the CODE ref to create these types.

Niek Albers,

Copyright (c) 2007-2008 Niek Albers. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2009-01-01 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.