I have a client server scenario where the type conversion did by the SoapClient class in PHP, cannot tell wether an empty array is associative or numeric, and so defaults to numeric.
All exposed functions use basic types, no classes.
An associative array such as array("something"=>123)
gets converted to a map data type. However, when the same array is empty, such as array()
, it gets converted to an array on the Ruby side. Type casting to object (object)array()
will result in a struct data type on the Ruby side.
The argument is a bit more complex, not as simple as above:
array(
"options"=>array(
"plans"=>array(
0=>array(
"name"=>"abc",
"product_options"=>array(
"optional_key_determines_associative_array_data_type"=>0,
),
),
),
),
);
If the array under "product_options"
is empty, it gets converted to an array in Ruby, instead of a map. Once again, type casting to object in PHP results in a struct in Ruby.
What can I do on the PHP side to make empty "associative" arrays end up as maps on the Ruby side?
PHP 5.3.3, using SoapClient. Ruby 1.8.7, Rails 2.3.2 using Action Web Service.
SoapClient
& perform some operations inSoapClient::__doRequest
(you get the xml as a string as it will be sent).