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.
You need to:
Afterwards you can call every Service from Net Service Point as a Method of your remote call object.
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 );
}
}
This is how the remote method would be called: Just like a local method call!
$logic = new RemoteLogic();
$timestamp = $logic->getTimestamp( "r" );
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.)
- Object
- Net_CURL
)
- String(1)
- getTimestamp
- String(1)
- php
- Array(1)
- {
}
- String(1) argumentsGivenByServiceCaller
- a:1:{i:0;s:1:"r";}
)
- String(1)
- getTimestamp
- Array(1)
- {
}
- String(1) 0
- r
)
- String(1)
- r