XML_RPC2
[ class tree: XML_RPC2 ] [ index: XML_RPC2 ] [ all elements ]

Class: XML_RPC2_Server

Source Location: /XML_RPC2-1.1.2/XML/RPC2/Server.php

Class Overview


XML_RPC2_Server is the frontend class for exposing PHP functions via XML-RPC.


Author(s):

Copyright:

  • 2004-2006 Sergio Carvalho

Variables

Methods


Child classes:

XML_RPC2_Backend_Xmlrpcext_Server
XML_RPC server class XMLRPCext extension-based backend
XML_RPC2_Backend_Php_Server
XML_RPC server class PHP-only backend.

Inherited Variables

Inherited Methods


Class Details

[line 98]
XML_RPC2_Server is the frontend class for exposing PHP functions via XML-RPC.

Exporting a programatic interface via XML-RPC using XML_RPC2 is exceedingly easy:

The first step is to assemble all methods you wish to export into a class. You may either create a (abstract) class with exportable methods as static, or use an existing instance of an object.

You'll then need to document the methods using PHPDocumentor tags. XML_RPC2 will use the documentation for server introspection. You'll get something like this:

  1.  class ExampleServer {
  2.      /**
  3.       * hello says hello
  4.       *
  5.       * @param string  Name
  6.       * @return string Greetings
  7.       */
  8.      public static function hello($name)
  9.          return "Hello $name";
  10.      }
  11.  }

Now, instantiate the server, using the Factory method to select a backend and a call handler for you:

  1.  require_once 'XML/RPC2/Server.php';
  2.  $server XML_RPC2_Server::create('ExampleServer');
  3.  $server->handleCall();

This will create a server exporting all of the 'ExampleServer' class' methods. If you wish to export instance methods as well, pass an object instance to the factory instead:

  1.  require_once 'XML/RPC2/Server.php';
  2.  $server XML_RPC2_Server::create(new ExampleServer());
  3.  $server->handleCall();



[ Top ]


Class Variables

$autoDocument =  true

[line 133]

display html documentation of xmlrpc exported methods when there is no post datas
  • Access: protected

Type:   boolean


[ Top ]

$autoDocumentExternalLinks =  true

[line 140]

display external links at the end of autodocumented page
  • Access: protected

Type:   boolean


[ Top ]

$callHandler =  null

[line 110]

callHandler field

The call handler is responsible for executing the server exported methods

  • Access: protected

Type:   mixed


[ Top ]

$encoding =  'utf-8'

[line 126]

encoding field

TODO : work on encoding for this backend

  • Access: protected

Type:   string


[ Top ]

$input =

[line 159]

input handler

Implementation of XML_RPC2_Server_Input that feeds this server with input

  • Access: protected



[ Top ]

$prefix =  ''

[line 117]

prefix field
  • Access: protected

Type:   string


[ Top ]

$signatureChecking =  true

[line 150]

signature checking flag

if set to true, the server will check the method signature before calling the corresponding php method

  • Access: protected

Type:   boolean


[ Top ]



Method Detail

__construct (Constructor)   [line 170]

XML_RPC2_Server __construct( object $callHandler, [array $options = array()])

Create a new XML-RPC Server.
  • Access: protected

Overridden in child classes as:

XML_RPC2_Backend_Xmlrpcext_Server::__construct()
Create a new XML-RPC Server.
XML_RPC2_Backend_Php_Server::__construct()
Create a new XML-RPC Server.

Parameters:

object   $callHandler   —  the call handler will receive a method call for each remote call received.
array   $options   —  associative array of options

[ Top ]

autoDocument   [line 283]

string autoDocument( )

autoDocument. Produce an HTML page from the result of server introspection
  • Return: HTML document describing this server
  • Access: public

[ Top ]

create   [line 213]

object a create( mixed $callTarget, [array $options = array()])

Factory method to select a backend and return a new XML_RPC2_Server based on the backend
  • Return: server class instance
  • Access: public

Parameters:

mixed   $callTarget   —  either a class name or an object instance.
array   $options   —  associative array of options

[ Top ]

errorToException   [line 259]

void errorToException( int $errno, string $errstr, string $errfile, int $errline)

Transform an error into an exception
  • Access: public

Parameters:

int   $errno   —  error number
string   $errstr   —  error string
string   $errfile   —  error file
int   $errline   —  error line

[ Top ]

getContentLength   [line 341]

integer getContentLength( string $content)

Gets the content legth of a serialized XML-RPC message in bytes
  • Return: the content length in bytes.
  • Access: protected

Parameters:

string   $content   —  the serialized XML-RPC message.

[ Top ]

handleCall   [line 246]

void handleCall( )

Receive the XML-RPC request, decode the HTTP payload, delegate execution to the call handler, and output the encoded call handler response.
  • Abstract:
  • Access: public

Overridden in child classes as:

XML_RPC2_Backend_Xmlrpcext_Server::handleCall()
Respond to the XML-RPC request.
XML_RPC2_Backend_Php_Server::handleCall()
Receive the XML-RPC request, decode the HTTP payload, delegate execution to the call handler, and output the encoded call handler response.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:56:39 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.