我在 SOAP 中的响应有一些问题。一般来说,我无法理解如何将响应作为我的 SOAP 客户端的多维关联数组。我使用了 NuSOAP v 1.123 库。
所以我在 SOAP-server 中有该代码:
$server->wsdl->addComplexType(
'ReturnDataInside',
'complexType',
'struct',
'all',
'',
array(
'message' => array('name' => 'message', 'type' => 'xsd:string', 'nillable' => 'true'),
'value' => array('name' => 'value', 'type' => 'xsd:string', 'nillable' => 'true'),
)
);
$server->wsdl->addComplexType(
'ReturnDataOutside',
'complexType',
'array',
'all',
'',
array(),
array(),
'tns:ReturnDataInside'
);
$server->register('test',
array('param_1' => 'xsd:int', 'param_2' => 'xsd:string'),
array('return' => 'tns:ReturnDataOutside')
);
function test($param_1, $param_2)
{
$data = array(
'test' => array(
'message' => 'string',
'value' => 'string',
),
);
return $data;
}
我的回复是这样的:
Array
(
[0] => Array
(
[message] => string
[value] => string
)
)
那么在我的响应 m.array 中要更改什么以将“测试”作为键?