On Thu, 15 Sep 2005 00:28:25 +1000, alistair wrote: > I have no idea how to contruct the dispatch map to build the WSDL to > inform the clients. > > Is this even possible in SOAP &/or the PEAR server implementation? > in PEAR::SOAP this works: <?php // authServer.php require_once 'SOAP/Server.php'; require_once 'SOAP/Disco.php'; // The handler of SOAP headers class HeaderHandler { var $_method_namespace = 'urn:AuthHandler'; var $_authenticated = FALSE; var $__dispatch_map = array(); function HeaderHandler() { $this->__dispatch_map['authenticate'] = array( 'in' => array( 'username' => 'string', 'password' => 'string' ), 'out' => array('auth' => 'string') ); } function authenticate($authinfo) { if ($authinfo->username == 'foo' && $authinfo->password == 'bar') { $this->_authenticated = TRUE; return 'Authentication OK'; } $faultcode = 'Client'; $faultstring = 'Invalid Authentication'; $faultactor = $this->_method_namespace; $detail = $this; return new SOAP_Fault($faultstring, $faultcode, $faultactor, $detail); } } // The class server class Simple_Server { var $_method_namespace = 'urn:AuthServer'; var $__dispatch_map = array(); var $_headers; function Simple_Server() { global $server; $this->_headers = new HeaderHandler; $server->addObjectMap($this->_headers, 'urn:AuthHandler'); $this->__dispatch_map['echoString'] = array( 'in' => array('text' => 'string'), 'out' => array('text' => 'string') ); } function echoString($text) { if (!$this->_headers->_authenticated) { $faultcode = 'Client'; $faultstring = 'You must send authentication headers'; $faultactor = $this->_method_namespace; $detail = $this; return new SOAP_Fault($faultstring, $faultcode, $faultactor, $detail); } return $text; } } $server = new SOAP_Server; $myserver = new Simple_Server(); $server->addObjectMap($myserver, 'urn:AuthServer'); if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD']=='POST') { $server->service($GLOBALS['HTTP_RAW_POST_DATA']); } else { // Create the DISCO server $disco =& new SOAP_DISCO_Server($server,' AuthServer'); header("Content-type: text/xml"); if (isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'],'wsdl') == 0) { echo $disco->getWSDL(); } else echo $disco->getDISCO(); } ?> -- Hilsen/Regards Michael Rasmussen http://keyserver.veridis.com:11371/pks/lookup?op=get&search=0xE3E80917 -- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php