How to Return non associative arrays with new soap

Lets assume this is the data I want to return

array(3) {
[”data”] => array(2) {
[0] => string(5) “abc”
[1] => string(3) “def”
}
[”successful”] => bool(true)
[”message”]=> string(49) “Transaction successful.”
}

Here are the 2 complex types I created

The first one is the array for the data element
$server -> wsdl ->
addComplexType(”return_data_array_multi”
, “complexType”
, “array”
, “”
, “SOAP-ENC:Array”
, array()
, array(array(”ref”
=> “SOAP-ENC:arrayType” , “wsdl:arrayType” =>
“xsd:string”))
, “xsd:string”);

The second one is the structure to hold the data,
success and message
$server -> wsdl -> addComplexType(”return_data”
, “complexType”
, “struct”
, “all”
, “”
, array(”data” =>
array(”name” => “data” , “type” =>
“tns:return_data_array_multi”)
, “successful”
=> array(”name” => “successful” , “type” =>
“xsd:boolean”)
, “message” =>
array(”name” => “message” , “type” => “xsd:string”)));

Hope this helps someone else


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply

Spam protection by WP Captcha-Free