Re: how to handle SoapServer response

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks a lot for this hints, it helped me a lot getting deeper into
webservice understanding.
I'm now running both SoapClient and SoapServer with explicitly set wsdl
file. Returning the values works fine...
But I now have problems with putting in the values for the login
function....
The listing of functions of the SoapServer tells me that there is the login
function as you said with one parameter: 

loginResponse login(login $in)

So I changed the servers method to accept one parameter:

function login($login) { ... }

As far as I understand I've to give the parameter the same way as I give it
back on the response:

return array('out' => $user);

So for the call of login it should be this, shouldn't it?:

$result = $this->soapClient->login(array(array('username' => $username,
'password' => $password)));

Unfortunatly this tells me that the username property is not set. So I tried
it with a class having a username and password property:

class LoginContainer {
	public $username;
	public $password;
}
...
$login = new LoginContainer();
$login->username = $username;
$login->password = $password;		
$result = $this->soapClient->login($login);

But this does not work too as the $login value always is a stdClass with no
vars and functions in the login function on the server.
So what is the correct way to put in the values?
Thanks in advance!



Rob Richards wrote:
> 
> First, you probably want the SoapServer using the wsdl since the client 
> is using it - otherwise you have to make sure that you are returning the 
> structure according to the definitions in the wsdl - which you aren't.
> Your server is returning data but the client is expecting it differently 
> thus you have an empty object.
> 
> Once you start using the wsdl on the server side, the login function 
> takes a single parameter. Your using doc/literal.
> It ends up being an object with the username and password as properties.
> 
> You then also need to return the user object as a single value: 
> array('out'=>$user)
> 
> "out" being the element name within the loginResponse element in the WSDL.
> 
> Rob
> 
> dArignac wrote:
>> Addition:
>> 
>> When I enable tracing I can see the results:
>> 
>> $this->soapClient->__getLastResponse()
>> gets
>> 666chefkochMr. Allmighty
>> 
>> but
>> var_dump($result);
>> gets
>> object(stdClass)#3 (0) { } 
> 
> -- 
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-handle-SoapServer-response-tf3579157.html#a10127405
Sent from the Php - Soap mailing list archive at Nabble.com.

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux