require_once('soap/nusoap.php');
$soap = new soap_server();
$soap->configureWSDL('ClientSecurityService','http://localhost/sec/webservices/');
$soap->wsdl->schemaTargetNamespace = 'http://www.soapinterop.org/xsd/';
$soap->register(
'user_authentication',
array(
'apikey' =>'xsd:string',
'scretekey' =>'xsd:string',
'emailaddress' =>'xsd:string',
'password' =>'xsd:string',
),
array('message'=>'xsd:string'),
'http://soapinterop.org'
);
$soap->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
function user_register($apikey='', $scretekey='', $username='', $emailaddress='', $password='', $first_name='', $last_name='', $date_of_birth='', $user_ip=''){
if(API_class::check_credentials($apikey, $scretekey) == true){
$error = '';
$validation = new Validation_class();
$validation->validate[] = $emailaddress . '|Email address |req|email';
$validation->validate[] = $password . '|Password |req';
$validation->validate[] = $first_name . '|First name |req';
$validation->validate[] = $last_name . '|Last name |req';
$error = $validation->validation('p');
if($error == ''){
$new_user = new User_class();
$new_user->uname = $username;
$new_user->email_address = $emailaddress;
$new_user->hashed_password = md5($password);
$new_user->fname = $first_name;
$new_user->lname = $last_name;
$new_user->date_of_birth = $date_of_birth;
$new_user->user_ip = $user_ip;
$new_user->save();
$message = 'User created successfully';
} else {
$message = $error;
}
} else {
$message = 'Invalid API Reference.';
}
return $message;
}
function user_authentication($apikey='', $scretekey='', $emailaddress='', $password=''){
if(API_class::check_credentials($apikey, $scretekey) == true){
$error = '';
$validation = new Validation_class();
$validation->validate[] = $emailaddress . '|Email address |req|email';
$validation->validate[] = $password . '|Password |req';
$error = $validation->validation('p');
if($error == ''){
//$password = md
$user_login = User_class::user_authentication($emailaddress,$password);
if($user_login != false){
session_start();
$_SESSION['user_id'] = $user_login->user_id;
$message = $_SESSION['user_id'];
} else {
$message = 'Invalid login information.';
}
} else {
$message = $error;
}
} else {
$message = 'Invalid API Reference.';
}
return $message;
}
我正在尝试生成一个 Web 服务,它可以为用户提供登录能力,但是,我想在提供者网站上注册会话,所有代码都工作正常,作为响应它显示会话 ID,但是当我访问页面时提供者站点并尝试打印该会话,它显示为空。
谁能帮我为什么这段代码没有在 WebService Provider 网站上注册会话?