Service Call Demo

This demo shows how the Net_Service_Caller can be used to implement an "local" data or logic object.
You can use this technology to mask "remote" Net Service Calls for easy "local" developement.

Requirements

You need to:

Afterwards you can call every Service from Net Service Point as a Method of your remote call object.

Example

Remote Method Call Class

Your remote logic class, which connects to a Net Service in background.

class RemoteLogic extends Net_Service_Caller
{
	protected $serviceUrl	= "http://yourserver.com/services/";
	public function __construct()
	{
		parent::__construct( $this->serviceUrl );	
	}
}
    

Remote Method Call

This is how the remote method would be called: Just like a local method call!

$logic		= new RemoteLogic();
$timestamp	= $logic->getTimestamp( "r" );
    

Service Response

And this would be the value of $timestamp: The UNIX timestamp on the Server.

Note: If your Net Service Point is not set up or your Service is not implemented or your Services is throwing an Exception, you will see an Exception here.
Message
URL "http://services.ceusmedia.com/public1/?service=getTimestamp&format=php" can not be accessed (HTTP Code 500).
Code
500
Type
RuntimeException
File
/var/www/lib/cmClasses/trunk/src/Net/Service/Client.php5
Line
114
Trace
  1. /var/www/lib/cmClasses/trunk/src/Net/Service/Client.php5[212]: Net_Service_Client->executeRequest(
    Object
    Net_CURL
    )
  2. /var/www/lib/cmClasses/trunk/src/Net/Service/Caller.php5[72]: Net_Service_Client->post(
    String(1)
    getTimestamp
    String(1)
    php
    Array(1)
    {
    String(1) argumentsGivenByServiceCaller
    a:1:{i:0;s:1:"r";}
    }
    )
  3. Net_Service_Caller->__call(
    String(1)
    getTimestamp
    Array(1)
    {
    String(1) 0
    r
    }
    )
  4. /demos/cmClasses/Net_Service_Caller/index.php5[18]: RemoteLogic->getTimestamp(
    String(1)
    r
    )

Service Calls