I have a function on the SOAP server that returns a two dimensional array
example (A function which returns an associative array where one field is a two-dimensional array):
function example_function($id_array){
$res = array("errors" => false, "message" => "ok message", "2_array" => array(array("asd" => 1, "sdf" => 2), array("asd" => 3, "sdf" => 5)));
echo "<pre>";
var_dump($res);
echo "</pre>";
return $res;
}
If you run this function directly, turning to the server, we get a well structured answer that I need
array(3) {
["errors"]=>
bool(false)
["message"]=>
string(10) "ok message"
["2_array"]=>
array(2) {
[0]=>
array(2) {
["asd"]=>
int(1)
["sdf"]=>
int(2)
}
[1]=>
array(2) {
["asd"]=>
int(3)
["sdf"]=>
int(5)
}
}
}
But, if we run this function from the SoapClient, we get the following output:
$opts = array(
'http' => array(
'user_agent' => 'PHPSoapClient'
)
);
$context = stream_context_create($opts);
$soapClientOptions = array(
'stream_context' => $context,
'cache_wsdl' => WSDL_CACHE_NONE,
'soap_version' => SOAP_1_2,
);
$client = new SoapClient("http://some_address/wsdl.wsdl", $soapClientOptions);
$result = $client->example_function();
var_dump($result);
return:
object(stdClass)#195 (3) {
["errors"]=>
bool(false)
["message"]=>
string(23) "ok message"
["2_array"]=>
object(stdClass)#196 (1) { //I don't know why is stdClass
["Map"]=>
array(2) {
[0]=>
object(stdClass)#202 (1) { //I dont't know why "item"
["item"]=>
array(2) {
[0]=>
object(stdClass)#203 (2) {
["key"]=>
string(3) "asd"
["value"]=>
string(1) "1"
}
[1]=>
object(stdClass)#204 (2) {
["key"]=>
string(3) "sdf"
["value"]=>
string(1) "2"
}
}
}
[1]=>
object(stdClass)#205 (1) {
["item"]=>
array(2) {
//similarly
}
}
}
}
}
What could be the error?