「PHPの学習」phpでwebserviceの呼び出すクライアント(soapclient )サンプルプログラム
phpコード:
<?php
$url = “url?WSDL";
$client = new SoapClient($url);
$params = array(
'szLoginName_IN’=>’startnews24_test_925’,
'szFPWD_IN’=>’925ygl9989’,
);
$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);
?>