小编Son*_*nia的帖子

nusoap如何返回数组?

我写server.php如下:

require_once("lib/nusoap.php");
require_once("connect.php");

$server = new soap_server;

$server->configureWSDL('server', 'urn:RM');

$server->wsdl->addComplexType(
    'game',
    'complexType',
    'struct',
    'all',
    '',
    array(
     'eventId'=>array('name'=>'eventId','type'=>'xsd:int'),
     'eventName'=>array('name'=>'eventName','type'=>'xsd:string'))
    );

$server->register('gamelist',
    array('id'=>'xsd:int'),
    array('return'=>'tns:game'),
    'urn:RM',
    'urn:RM#gamelist',
    'rpc',
    'encoded',
    'Get Games Info');

function gamelist($id){
 $query="select eventId, eventName from jos_games where parentId='$id'";
 $rs=mysql_query($query);

 $game=array();
 while($row=mysql_fetch_assoc($rs)){
  $game[]= $row;
 }
 //print_r($game);
 return $game;
}


$HTTPRAW_POST_DATA = isset($HTTP_RAW_POST_DATA)? $HTTP_RAW_POST_DATA:"";  
$server->service($HTTP_RAW_POST_DATA);
Run Code Online (Sandbox Code Playgroud)

client.php如下:

require_once("lib/nusoap.php");

$client =  new nusoap_client('http://sonia.ecisoft.com/soap/server.php');


if($err=$client->getError()){
 echo 'Error:'.$err;
}

$id=1;
$return = $client->call('gamelist', array('id'=>$id));

print_r($return);
Run Code Online (Sandbox Code Playgroud)

我无法从client.php返回.我想列出eventId,eventName的行.请帮帮我,谢谢.

php arrays soap nusoap

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

arrays ×1

nusoap ×1

php ×1

soap ×1