欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

webservice

程序员文章站 2022-06-08 09:02:37
...
php代码
<?php
$url = "url?WSDL";
$client = new SoapClient($url);
$params = array(
	'szLoginName_IN'=>'monkeytest3050',
	'szFPWD_IN'=>'qwe123',
);

$res = $client->__soapCall("UserWSLogin",array('parameters'=>$params));
if($res->UserWSLoginResult === true)
{
	switch($res->uAWI_OUT)
	{
		case 0:
			$result['REV'] = true;			
			$result['DATA'] = array(
				'uUserID_OUT'=>$res->uUserID_OUT,
				'szNickName_OUT'=>$res->szNickName_OUT,
				'uFigureID_OUT'=>$res->uFigureID_OUT
			);
			break;
		case 20:
			$result['REV'] = false;
			$result['MSG'] = "用户密码错误";
			break;
		case 2:
			$result['REV'] = false;
			$result['MSG'] = $res->szPromptText_OUT;
			break;
		default:
			$result['REV'] = false;
			$result['MSG'] = "未定义错误:ws[".$res->uAWI_OUT."]";
			break;
	}
}
else 
{
	$result['REV'] = false;
	$result['MSG'] = "调用服务失败,请稍后再试";
}
var_dump($result);
?>
相关标签: webservice