Home > Backend Development > PHP Tutorial > 请教webservice

请教webservice

WBOY
Release: 2016-06-23 14:02:29
Original
845 people have browsed it

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 />"; }
Copy after login

正常应该有返回值
但是我的返回值为空
我现在怀疑就是由于服务端定义了一个自定义方法 我用
php服务传入参数造成
请各位大侠帮忙看看


回复讨论(解决方案)

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' => '',
)
这样的数组,你的好像不是

谢谢斑竹 解决了

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template