views:

48

answers:

1

Say I have a simple client/server scenario with one method:

// client code
$client = new SoapClient("service.wsdl");
$result = $client.getPi();

...

// server code
function getPi(){
   return 3.141;
}
$server = new SoapServer("service.wsdl");
$server.addFunction("getPi");
$server.handle();

Am I right in thinking that when the client makes a call to the getPi() method the addfunction() gets called everytime? Is this really how PHP SOAP web services work? Or is there some caching going on?

Thanks.

+1  A: 

The server code will be executed each time a request is made to the webservice -- which means that, yes, the addfunction() will get called each time.

But calling that function should not take that long (or that much resources), compared to the time it takes for a request to go through the network, anyway (web-service = remote call = using an HTTP request = not that fast at all ^^ ) ;-)

Pascal MARTIN