Posts Tagged ‘client’

Disable WSDL caching in PHP

Monday, September 22nd, 2008

If you are finding that your SOAP web service isn’t updating when you make changes you have to add the line ini_set("soap.wsdl_cache_enabled", "0"); to both the Server and the Client.

i.e.

<?php
class SoapController
{
 function HelloWorld($name)
 {
  return "Hello ". strrev($name) ;
 }
}
ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer('http://example.com/soap.wsdl');
$server->setClass("SoapController");
$server->handle();
?>

and

<?php
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient('http://example.com/soap.wsdl', array('trace' => 1));
print_r($client->HelloWorld("Damian"));
?>