The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Jabber::RPC::Client - Jabber-RPC Client

SYNOPSIS

  use Jabber::RPC::Client;

  # Client connects as Jabber client
  my $client = new Jabber::RPC::Client(
    server    => 'myserver.org',
    identauth => 'user:password',
    endpoint  => 'jrpc.myserver.org/rpc-server',
  );  

  my $result = $client->call('examples.getStateName', 5);
  print "getStateName: ", $result || $client->lastfault, "\n";

  # Switch endpoints
  $client->endpoint('another@endpoint.org/resource');
  
  # This time the call will go to the new endpoint
  my $result = $client->call('examples.getStateList', [12,13,14]);
  print "getStateList: ", $result || $client->lastfault, "\n";

DESCRIPTION

Jabber::RPC::Client is an implementation of a Jabber-RPC client. A Jabber-RPC client sends XML-RPC-encoded calls carried over Jabber to an endpoint that is a Jabber::RPC::Server.

It uses the Frontier::RPC2 XML-RPC implementation to make the encoding and decoding calls.

The endpoint can either be a Jabber component or a Jabber client (see the SYNOPSIS examples for Jabber::RPC::Server) - specify the JID of the endpoint appropriately.

You can change the endpoint with the endpoint() function.

If you don't specify any value for a 'resource' argument, a default of 'jrpc-client' will be used. Bear in mind that if you haven't specified a value for the 'resource' argument when starting the Jabber::RPC::Server, a default of 'jrpc-server' will be used there. Hence the endpoint of 'jrpc.myserver.org/rpc-server' in the synopsis example above.

VERSION

early

AUTHOR

DJ Adams

SEE ALSO

Jabber::RPC::Server, Jabber::Connection