1

我正在使用 nusoap,但在使用 web 服务时遇到了困难……我试图返回给谁使用其中一个 web 服务的是一个数组……在第一种情况下,我试图返回这种类型的大批:

Array ( [0] => EX123EX [1] => Test [2] => 2013/04/27 [3] => 12:06 [4] => This is a test [5] => [+]Info [-]Info ) 

为此,我有:

$server->wsdl->addComplexType(
'details',
'complexType',
'struct',
'all',
'',
array(
        'id' => array('name' => 'id', 'type' => 'xsd:string'),
        'product' => array('name' => 'product', 'type' => 'xsd:string'),
        'date' => array('name' => 'date', 'type' => 'xsd:string'),
        'hour' => array('name' => 'hour', 'type' => 'xsd:string'),
        'status' => array('name' => 'status', 'type' => 'xsd:string'),
    'info' => array('name' => 'info', 'type' => 'xsd:string'),
));

$server->register(
'getdetails',
array('url' => 'xsd:string'),
array('return' => 'tns:details'),
            $namespace,
            false,
            'rpc',
            'literal',
            'details');

和功能:

function getdetalhes($url)
{
$details = getHeader($url);
return $details;
}

问题是网络服务没有被消耗......当我提出请求时,我没有答案......有了这个错误,我也无法继续下一个将返回具有这种结构的数组的网络服务:

Array ( [0] => Array ( ) [1] => Array ( [0] => 2012/12/13 [1] => 12:06 [2] => Test [3] => - [4] => Test Test  [5] => Test ) [2] => Array ( [0] => 2012/12/13 [1] => 09:23 [2] => Test Test  [3] => - [4] => Test  [5] => - ) [3] => Array ( [0] => 2012/12/12 [1] => 17:43 [2] => Test  [3] => - [4] => Test  [5] => - ) [4] => Array ( [0] => 2012/12/12 [1] => 11:25 [2] => Test  [3] => Test  [4] =>Test [5] => - )

我确信错误出现在 complexType 声明上,但我不知道问题出在哪里,有人可以帮我吗?

4

1 回答 1

1

请确保您访问的是数组的关联关键字而不是索引:)

于 2013-04-30T10:41:24.980 回答