Hi Tristan, Thank's for your help. Now this little test is working... Regards, Neto. "Tristan Ludowyk" <tristan00au@yahoo.com> escreveu na mensagem 000201c371a9$e5583200$6e00a8c0@ritalin">news:000201c371a9$e5583200$6e00a8c0@ritalin... Somewhere you need to add the header_handler to the object map of the server. In the example it is done inside the constructor for the soap class: class SOAP_Auth_Server { function SOAP_Auth_Server() { global server; $this->headers = new Header_Handler(); $server->addObjectMap($this->headers); } ... Tristan. > -----Original Message----- > From: José Morelli Neto [mailto:neto@univali.br] > Sent: Wednesday, 3 September 2003 4:01 AM > To: soap@lists.php.net > Subject: [SOAP] Authentication on header, > > > Hi Folks! > > I'm trying to make a test web server that authenticate > before execute any method. I´m try to use one example made > from Shane Caraveo > (http://talks.php.net/show/soap-phpcon-ny2003/64), but i give > an error like this: > > -------------------- error ------------------------ > soap_fault Object > ( > [error_message_prefix] => > [mode] => 1 > [level] => 1024 > [code] => SOAP-ENV:MustUnderstand > [message] => I don't understand header authenticate. > [userinfo] => Array > -------------------- error ------------------------ > > > The source i have test is this: > > -------------------- server code ------------------------ > <?php > include("SOAP/Client.php"); > > $soapclient =& new SOAP_Client("http://localhost/server.php"); > > $aee = array("username"=>"foo","password"=>"bar"); > $header = new SOAP_Header( > "{urn:Header_Handler}authenticate", "Struct", $aee, "1"); > $soapclient->addHeader($header); > > $options = array("namespace" => "urn:SOAP_Auth_Server", > "trace" => 1); $params = array("inputString"=>"this is a > test"); $ret = $soapclient->call('echoString', $params > ,$options); echo "<pre>"; print_r($ret); ?> > -------------------- server code ------------------------ > > -------------------- client code ------------------------ > <?php > require_once 'SOAP/Server.php'; > > class Header_Handler { > var $method_namespace = 'urn:Header_Handler'; > var $authenticated = FALSE; > > 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 = NULL; > return new SOAP_Fault($faultstring, > $faultcode, > $faultactor, > $detail); > } > } > > class SOAP_Auth_Server { > function echoString($inputString) > { > if (!$this->headers->authenticated) { > return "Autenticated! ... $inputString"; > } else { > return "You don´t have permission to execute any operation ... "; > } > } > } > $server =& new SOAP_Server; > $soapclass =& new SOAP_Auth_Server(); > $server->addObjectMap($soapclass,'urn:SOAP_Auth_Server'); > $server->service($HTTP_RAW_POST_DATA); > ?> > -------------------- client code ------------------------ > > > Can anyone help me with this? i'm new with pear::soap ... > > > Thank's for All!! > Neto. > > -- > PHP Soap Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php