创建复杂类型nusoap php

时间:2016-03-22 15:34:04

标签: php nusoap

我从事个人网络服务项目nusoap我上周第一次通过网络信息启动网络服务。

目前我正在尝试编写一个以表格形式插入元素的Web服务。

这是文件服务器:

    error_reporting(E_ALL);
     // Pull in the NuSOAP code
    require_once('lib/nusoap.php');
    // Create the client instance
    $client = new nusoap_client('http://localhost/testajout/server.php');
 $cordonne['id']=NULL;
  $cordonne['nom']=$_POST['nom'];
  $cordonne['prenom']=$_POST['prenom'];
  $cordonne['datedebut']=$_POST['dateDebut'];
  $cordonne['solde']=$_POST['solde'];
  $cordonne['identifient']=$_POST['identifient'];
  $cordonne['photo']=$_POST['photo'];
  $cordonne['fid']=$_POST['clientFid'];
  $cordonne['codebarre']=$_POST['codebarre'];

     $res = $client->call('InsertUser',array('cordonne'=>$cordonne));
      print_r($res);

客户代码:

{{1}}

什么都没有显示。

1 个答案:

答案 0 :(得分:0)

请在complextype数组的定义中使用正确的数组键

$server->wsdl->addComplexType(
'cordonne',
'complexType',
'struct',
'all',
'',
array(
      'id'=> array('name' => 'id', 'type' => 'xsd:int'),
      'prenom'=> array('name' => 'prenom', 'type' => 'xsd:string'),
      'lastname'=> array('name' => 'lastname', 'type' => 'xsd:string'),
      'datedebut'=> array('name' => 'datedebut', 'type' => 'xsd:date'),
      'solde'=> array('name' => 'solde', 'type' => 'xsd:decimal'),
      'identifient'=> array('name' => 'identifient', 'type' => 'xsd:string'),
      'photo' => array('name' => 'photo', 'type' => 'xsd:string'),
      'fid'=> array('name' => 'fid', 'type' => 'xsd:int'),
      'codebarre' => array('name' => 'codebarre', 'type' => 'xsd:string')
     ));

而不是将带有密钥的数组传递给服务器,而只是发送没有密钥的数组

$res = $client->call('InsertUser',array($cordonne));
相关问题