Webservice and @return string[]

I’m following this to develope a webservice:


A webservice with this method works:



public function test_1(){

$str = "foo bar";

return $str;


But if I set this method in the webservice:



public function test_2(){

$array_str = array(

"foo" => "bar",

"bar" => "foo",


return $array_str;


I get this error when I try to load the wsdl: “The value ‘xsd:stringArray’ is an invalid name.”

The documentation says:

"We can also use array type by appending [] to the end of a primitive or composite type."

And the primitive types are:

str/string: maps to xsd:string;

int/integer: maps to xsd:int;

float/double: maps to xsd:float;

bool/boolean: maps to xsd:boolean;

date: maps to xsd:date;

time: maps to xsd:time;

datetime: maps to xsd:dateTime;

array: maps to xsd:string;

object: maps to xsd:struct;

mixed: maps to xsd:anyType.

Can you tell me how can I solve it?


Who says xsd:stringArray would be an invalid name? Unfortunately, there are several ways to encode a soap messages. So, although a wsdl might be valid, a tool using another encoding might refuse to accept it. Ideally, yii should try to achieve WS-I compliance to ensure optimal interoperability. However, I don’t know how much (if any) effort is put into this.

Hello Ben, the error is reported by Soap UI when tries to load de wsdl.

The problem is the CWsdlGenerator class of the framework, that has a bug.

I am using yii 1.1.10 version,& in that ,perfectly working ur string[],there is no issue with it, upgrade with lates yii version.