note 116074 added to class.soapclient
| From: | prabowo | Date: | Thu, 06 Nov 2014 08:34:19 +0000 |
| Subject: | note 116074 added to class.soapclient | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200798@lists.php.net to get a copy of this message | ||
Using Zimbra 8.5 server as SOAP server i found that you first need to authenticate yourself using
authRequest then using authToken from the authResponse 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";
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 202.137.23.194
----
Manual Page -- http://php.net/manual/en/class.soapclient.php
Edit -- https://master.php.net/note/edit/116074
Del: integrated -- https://master.php.net/note/delete/116074/integrated
Del: useless -- https://master.php.net/note/delete/116074/useless
Del: bad code -- https://master.php.net/note/delete/116074/bad+code
Del: spam -- https://master.php.net/note/delete/116074/spam
Del: non-english -- https://master.php.net/note/delete/116074/non-english
Del: in docs -- https://master.php.net/note/delete/116074/in+docs
Del: other reasons-- https://master.php.net/note/delete/116074
Reject -- https://master.php.net/note/reject/116074
Search -- https://master.php.net/manage/user-notes.php