note 116075 deleted from class.soapclient by salathe

From: Date: Fri, 07 Nov 2014 11:17:29 +0000
Subject: note 116075 deleted from class.soapclient by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-200836@lists.php.net to get a copy of this message
Note Submitter: prabowo[dot]priyo[at]gmail.com ---- Using Zimbra 8.5 server as SOAP server i found that you first need to authenticate yourself using [b]authRequest[/b] then using [b]authToken[/b] from the [b]authResponse[/b] to form a header. Without a valid SOAPHeader you will get "no valid authtoken present" error. BTW, you may be don't need this if you are running the php scripts on the same server with zimbra <?php //Predefined variables $S = array( "server" => "mail.b-studio.web.id", "username" => "admin", "password" => "mypassword" ); try{ $S["client"] = new soapclient('https://'.$S["server"].'/service/wsdl/ZimbraAdminService.wsdl'); $response = $S["client"]->authRequest(array("name"=>$S['username'],"password"=>$S['password'])); $S["authToken"] = $response->authToken; $S["header"] = new SOAPHeader("urn:zimbra","context",array("authToken"=>$S["authToken"])); $S["client"]->__setSoapHeaders($S["header"]); $response=$S["client"]->GetAllCosRequest(); var_dump($response); }catch (Exception $e){ echo "Exception: {$e->getMessage()}\n"; } ?>

« previous php.notes (#200836) next »