Maison >développement back-end >tutoriel php >请教webservice
http://121.33.201.180:6005/RegMember.asmx?WSDL
这个是.net写的webservice服务端
需要调用其中InsertMember方法
$client_reg = new SoapClient("http://121.33.201.180:6005/RegMember.asmx?WSDL");$functions = $client_reg->__getFunctions();//print_r($functions);$types = $client_reg->__getTypes();//print_r($types);$client_reg->soap_defencoding = 'utf-8';$client_reg->xml_encoding = 'utf-8'; //$param_reg = array('CInsertMember' => array('Name'=>"你好",'Identity'=>"230105198311202013",'Mobile'=>"15014689527",'IsWap'=>true),'fellowID'=>$value,'sCardNum'=>"",'InsertMemberResult'=>"");$p_reg = $client_reg->__soapCall("InsertMember",array('parameters' => $param_reg));/*$param_reg = array('CInsertMember'=>'','Name'=>"你好",'Identity'=>"230105198311202013",'Mobile'=>"15014689527",'IsWap'=>True,'fellowID'=>$value,'sCardNum'=>"",'InsertMemberResult'=>"");$p_reg = $client_reg->__soapCall('InsertMember',array('parameters' => $param_reg));*/print_r($p_reg);$array1 = get_object_vars($p_reg); foreach ($array1 as $key1 => $value1) { echo $key1.": ".$value1."<br />"; }
webserviece 服务端一般以wsdl结尾的吧,看看$client_reg 有没有实例化成功。
调用都成功了
返回
stdClass Object (
[InsertMemberResult] =>
[sCardNum] =>
)
InsertMemberResult:
sCardNum:
正常的话 InsertMemberResult sCardNum 应该有返回值
由
struct InsertMember {
CInsertMember objCInsertMember;
string fellowID;
string sCardNum;
}
struct CInsertMember {
string Name;
string Identity;
string Mobile;
boolean IsWap;
}
可知 InsertMember(InsertMember $parameters)的参数应为
array(
'objCInsertMember' => array(
'Name' => '',
'Identity' => '',
'Mobile' => '',
'IsWap' => '',
),
'fellowID' => '',
'sCardNum' => '',
)
这样的数组,你的好像不是
谢谢斑竹 解决了