Re: SoapFault getMessage

From: Date: Sun, 14 Nov 2004 13:06:31 +0000
Subject: Re: SoapFault getMessage
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-1650@lists.php.net to get a copy of this message
Hannes, The end point has changed http://www.myweb-services.com/tools/UserApps.php?wsdl you should try again, re-register (CreateUser) and use your email address and password for the authentication process (AuthenticateUser). The WS would give a session Id. Re-use it each time you want to control the session (SessionControl). Enjoy :-) Guillaume (WS owner) Hannes Gassert wrote:
Hi,
I'm currently playing with the PHP5 SOAP extension and now have a little problem with the exception handling.
I tried to query a NuSOAP service, which can return an error like this (body only):
<SOAP-ENV:Body><SOAP-ENV:Fault> <faultcode>Client</faultcode> <faultactor>Authentication error</faultactor> <faultstring>You are not recognized by the authentication process</faultstring> <detail><soapVal xsi:type="xsd:string"></soapVal></detail></SOAP-ENV:Fault></SOAP-ENV:Body>
This, of course, causes a SoapFault exception to be thrown, but it seems like I can't access the error message:
$client = new SoapClient("http://www.myweb-services.com/server/UserApps.wsdl");
$fname = "Ali"; $lname = "Baba"; $email = "test@example.com"; $passwd = '123456789';
try { $myAuthenticationStruct = $client->AuthenticateUser($email, $passwd . "____"); var_dump($myAuthenticationStruct); } catch (SoapFault $f){ var_dump($f->getMessage()); // yields string(0) "" }
If I don't catch the SoapFault, a fatal error is issued containing the message "You are not recognized by the authentication process", so the information must be somewhere inside the exception. So how to access it, except just echoing the entire exception?
I tried with yesterday's snapshot if that matters.
Thanks a lot and kind regards, Hannes


« previous php.soap (#1650) next »