大家好,问个问题
php调用webservice进行用户注册,客户端$client已经连上了,但在调用一个方法和设置参数时出现问题了
print_r($client->__getFunctions());
得到
Array ([29] => addUserResponse addUser(addUser $parameters))print_r($client->__getTypes());得到
Array ([51] => struct addUserParams { string address; string atName; string authorIp; string authorIpV6; dateTime autologicDestroyTime; string baclName; boolean canOverDraft; string certNo; int certType; int edu; string email; }]文档上的java例子为:
利用客户端生成服务端口. 
SamService ss = new SamService();
SamServicePortType port = ss.getSamServicePort();                     
调用业务功能接口. 
AddUserParams user = new AddUserParams();
user.setUserId("user02");
user.setPassword("111");
user.setUserName("自由");
SamApiBaseResult res = helloService.addUser(user);
System.out.println(res.getErrorCode()+";"+res.getErrorMessage());
php要怎么做???

解决方案 »

  1.   

    我的代码
    try {
        $client = new SoapClient("http://ip/sam/services/samapi?wsdl",array('soap_version'=> SOAP_1_1,'login'  => "admin", 'password' => "password",'encoding'=>'UTF-8'));

       $parm=array('userId'=>$sno,'password'=>$sno,'userName'=>$name,'sex'=>$sex,'address'=>$addr,'mobile'=>$tel,'certType'=>1,'cerNo'=>$sfzh);
       $rs=$client->addUser($parm);
       
      echo $rs->errorCode.$rs->errorMessage;
      

    catch (SOAPFault $e) {
        print $e;
    }
    没有任何结果显示
      

  2.   

    如果你调用的是 addUser 方法,那么需要给出 print_r($client->__getTypes());得到的 addUser 项
      

  3.   

    即便你依据 struct addUserParams { string address; string atName; string authorIp; string authorIpV6; dateTime autologicDestroyTime; string baclName; boolean canOverDraft; string certNo; int certType; int edu; string email; }
    那也是不对的
    array(
      'address' => '',
      'atName' => '',
      'authorIp' => '',
      'authorIpV6' => '',
      'autologicDestroyTime' => '',
      'baclName' => '',
      'canOverDraft' => '',
      'certNo' => '',
      'certType' => '',
      'edu' => '',
      'email' => ''
    )