首页  >  文章  >  php教程  >  webservice

webservice

PHP中文网
PHP中文网原创
2016-05-25 17:04:411158浏览

php代码

<?php
$url = "url?WSDL";
$client = new SoapClient($url);
$params = array(
	&#39;szLoginName_IN&#39;=>&#39;monkeytest3050&#39;,
	&#39;szFPWD_IN&#39;=>&#39;qwe123&#39;,
);

$res = $client->__soapCall("UserWSLogin",array(&#39;parameters&#39;=>$params));
if($res->UserWSLoginResult === true)
{
	switch($res->uAWI_OUT)
	{
		case 0:
			$result[&#39;REV&#39;] = true;			
			$result[&#39;DATA&#39;] = array(
				&#39;uUserID_OUT&#39;=>$res->uUserID_OUT,
				&#39;szNickName_OUT&#39;=>$res->szNickName_OUT,
				&#39;uFigureID_OUT&#39;=>$res->uFigureID_OUT
			);
			break;
		case 20:
			$result[&#39;REV&#39;] = false;
			$result[&#39;MSG&#39;] = "用户密码错误";
			break;
		case 2:
			$result[&#39;REV&#39;] = false;
			$result[&#39;MSG&#39;] = $res->szPromptText_OUT;
			break;
		default:
			$result[&#39;REV&#39;] = false;
			$result[&#39;MSG&#39;] = "未定义错误:ws[".$res->uAWI_OUT."]";
			break;
	}
}
else 
{
	$result[&#39;REV&#39;] = false;
	$result[&#39;MSG&#39;] = "调用服务失败,请稍后再试";
}
var_dump($result);
?>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn