Home  >  Article  >  php教程  >  webservice

webservice

PHP中文网
PHP中文网Original
2016-05-25 17:04:411157browse

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);
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn