PHP Web服务没有消耗

时间:2013-04-27 19:20:49

标签: php web-services

我正在使用nusoap而且我在使用Web服务时遇到困难...我正在尝试返回哪些人使用其中一个webservices是一个数组...... 在第一种情况下,我正在尝试返回这种类型的数组:

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;
}

问题是web服务没有消耗......当我发出请求时我没有回答......有了这个错误,我也无法继续下一个会返回带有这种结构的数组的webservice :

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声明中,但我无法弄清楚问题是什么,有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

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