Hi guys,
I’m configuring my server for webservice but I’m have a problem.
I don´t understand how and where create my wsdl file.
I made an controller example but I don´t send an array like parameter…
My controller is
<?php
class WebServiceController extends CController {
public function actions() {
return array(
'wreader' => array(
'class' => 'CWebServiceAction',
),
);
}
/**
* @param string username
* @return float
* @soap
*/
public function getauth($uname) {
if ($uname == 'harpreet' && $pass == '123456'){
$session = Yii::app()->session;
$session['u_id'] = 1111;
return 1;
} else {
return 'Usuario o contraseña no son válidos';
}
}
/**
* @param string username
* @return float
* @soap
*/
public function getemp($uname) {
$session = Yii::app()->session;
return isset($session['u_id'])?$session['u_id']:999;
}
}
?>
My php file to call the service is
<?php
$arreglo = new Users();
$arreglo->uname = 'harpreet';
$arreglo->pass='123456';
$arreglo->shop='1';
$client=new SoapClient('http://myurl.com/prueba/index.php/wreader');
echo "\n".$client->getauth($arreglo);
echo "\n".$client->getemp('harpreet');
class Users {
public $uname;
public $pass;
public $shop;
}
?>
This is the error
Catchable fatal error : Object of class Users could not be converted to string in C:\wamp\www\myphp.php on line 8