WebService: The [] is not working well or i'm doing things bad

I've the following code in my soap



	/**


	 * @return UserRecord[]


	 * @soap


	 */


	public function getUserList(){


		$users = UserRecord::getUserList(true);


		foreach($users as $user){


			$user->utf8ize();


		}


		return $users;


	}


When i try it with the WebService Studio, the folowing error is coming when i get the wsdl.



Initializing


Generating WSDL


Generating Proxy


Schema parsing error Invalid 'name' attribute value 'tns:UserRecordArray': 'The ':' character, hexadecimal value 0x3A, at position 3 within the name, cannot be included in a name.'.


Schema parsing error Namespace 'http://schemas.xmlsoap.org/soap/encoding/' is not available to be referenced in this schema.


Schema parsing error Namespace 'http://schemas.xmlsoap.org/soap/encoding/' is not available to be referenced in this schema.


Schema could not be validated. Class generation may fail or may produce incorrect results


System.InvalidOperationException: Schema item 'complexType' named 'tns:UserRecordArray' from namespace 'urn:UsersoapControllerwsdl'.  ---> System.Xml.Schema.XmlSchemaException: Invalid 'name' attribute value 'tns:UserRecordArray': 'The ':' character, hexadecimal value 0x3A, at position 3 within the name, cannot be included in a name.'.


   at System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e, XmlSeverityType severity)


   at System.Xml.Schema.BaseProcessor.SendValidationEvent(String code, String msg1, String msg2, XmlSchemaObject source)


   at System.Xml.Schema.Preprocessor.ValidateNameAttribute(XmlSchemaObject xso)


   at System.Xml.Schema.Preprocessor.PreprocessComplexType(XmlSchemaComplexType complexType, Boolean local)


   at System.Xml.Schema.Preprocessor.Preprocess(XmlSchema schema, String targetNamespace, ArrayList imports)


   at System.Xml.Schema.Preprocessor.Execute(XmlSchema schema, String targetNamespace, Boolean loadExternals)


   at System.Xml.Serialization.XmlSchemas.Preprocess(XmlSchema schema)


   --- End of inner exception stack trace ---


   at System.Xml.Serialization.XmlSchemas.CreateValidationException(XmlSchemaException exception, String message)


   at System.Xml.Serialization.XmlSchemas.Preprocess(XmlSchema schema)


   at System.Xml.Serialization.XmlSchemas.Find(XmlQualifiedName name, Type type, Boolean checkCache)


   at System.Xml.Serialization.XmlSchemas.Find(XmlQualifiedName name, Type type)


   at System.Web.Services.Description.ServiceDescriptionImporter.Import(CodeNamespace codeNamespace, ImportContext importContext, Hashtable exportContext, StringCollection warnings)


   at System.Web.Services.Description.ServiceDescriptionImporter.Import(CodeNamespace codeNamespace, CodeCompileUnit codeCompileUnit)


   at WebServiceStudio.Wsdl.GenerateCode(ServiceDescriptionCollection sources, XmlSchemas schemas, String uriToWSDL, ICodeGenerator codeGen, String fileExtension)


   at WebServiceStudio.Wsdl.Generate()





But it works with PHP soap code like this:



$client=new SoapClient($this->createAbsoluteUrl("usersoap/index"));


var_dump($client->getUserList());


What's this error?

Do you know?

Thanks!

Not quite sure what is causing the problem. But why it complains the following:

Schema parsing error Namespace 'http://schemas.xmlsoap.org/soap/encoding/' is not available to be referenced in this schema.

I think it's because it is imported 3 times:

the wsdl is:



<?xml version="1.0" encoding="utf-16"?>


<wsdl:definitions xmlns:tns="urn:UsersoapControllerwsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" name="UsersoapController" targetNamespace="urn:UsersoapControllerwsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">


  <wsdl:types>


    <xsd:schema targetNamespace="urn:UsersoapControllerwsdl">


      <xsd:complexType name="UserRecord">


        <xsd:all>


          <xsd:element name="iduser" type="xsd:int" />


          <xsd:element name="username" type="xsd:string" />


          <xsd:element name="password" type="xsd:string" />


          <xsd:element name="nombre" type="xsd:string" />


          <xsd:element name="telefono" type="xsd:string" />


          <xsd:element name="direccion" type="xsd:string" />


          <xsd:element name="fecha_nacimiento" type="xsd:string" />


          <xsd:element name="celular" type="xsd:string" />


        </xsd:all>


      </xsd:complexType>


      <xsd:complexType name="tns:UserRecordArray">


        <xsd:complexContent mixed="false">


          <xsd:restriction base="soap-enc:Array">


            <xsd:attribute wsdl:arrayType="tns:UserRecord[]" ref="soap-enc:arrayType" />


          </xsd:restriction>


        </xsd:complexContent>


      </xsd:complexType>


    </xsd:schema>


  </wsdl:types>


  <wsdl:message name="loginRequest">


    <wsdl:part name="username" type="xsd:string" />


    <wsdl:part name="password" type="xsd:string" />


  </wsdl:message>


  <wsdl:message name="loginResponse">


    <wsdl:part name="return" type="tns:UserRecord" />


  </wsdl:message>


  <wsdl:message name="getUserListRequest" />


  <wsdl:message name="getUserListResponse">


    <wsdl:part name="return" type="tns:UserRecordArray" />


  </wsdl:message>


  <wsdl:message name="changeUserPasswordRequest">


    <wsdl:part name="iduser" type="xsd:int" />


    <wsdl:part name="newpassword" type="xsd:string" />


    <wsdl:part name="oldpassword" type="xsd:string" />


  </wsdl:message>


  <wsdl:message name="changeUserPasswordResponse">


    <wsdl:part name="return" type="xsd:boolean" />


  </wsdl:message>


  <wsdl:message name="changeUserDataRequest">


    <wsdl:part name="iduser" type="xsd:int" />


    <wsdl:part name="nombre" type="xsd:string" />


    <wsdl:part name="telefono" type="xsd:string" />


    <wsdl:part name="direccion" type="xsd:string" />


    <wsdl:part name="fecha_nacimiento" type="xsd:string" />


    <wsdl:part name="celular" type="xsd:string" />


  </wsdl:message>


  <wsdl:message name="changeUserDataResponse">


    <wsdl:part name="return" type="xsd:boolean" />


  </wsdl:message>


  <wsdl:message name="changeUserNameRequest">


    <wsdl:part name="iduser" type="xsd:int" />


    <wsdl:part name="newUsername" type="xsd:string" />


  </wsdl:message>


  <wsdl:message name="changeUserNameResponse">


    <wsdl:part name="return" type="xsd:boolean" />


  </wsdl:message>


  <wsdl:message name="addUserRequest">


    <wsdl:part name="username" type="xsd:string" />


    <wsdl:part name="password" type="xsd:string" />


    <wsdl:part name="nombre" type="xsd:string" />


    <wsdl:part name="telefono" type="xsd:string" />


    <wsdl:part name="direccion" type="xsd:string" />


    <wsdl:part name="fecha_nacimiento" type="xsd:string" />


    <wsdl:part name="celular" type="xsd:string" />


  </wsdl:message>


  <wsdl:message name="addUserResponse">


    <wsdl:part name="return" type="xsd:boolean" />


  </wsdl:message>


  <wsdl:message name="getUserRequest">


    <wsdl:part name="iduser" type="xsd:int" />


  </wsdl:message>


  <wsdl:message name="getUserResponse">


    <wsdl:part name="return" type="tns:UserRecord" />


  </wsdl:message>


  <wsdl:message name="getProfileListRequest" />


  <wsdl:message name="getProfileListResponse">


    <wsdl:part name="return" type="xsd:anyType" />


  </wsdl:message>


  <wsdl:portType name="UsersoapControllerPortType">


    <wsdl:operation name="login">


      <wsdl:documentation>Method: Login test</wsdl:documentation>


      <wsdl:input message="tns:loginRequest" />


      <wsdl:output message="tns:loginResponse" />


    </wsdl:operation>


    <wsdl:operation name="getUserList">


      <wsdl:documentation>Enter description here...</wsdl:documentation>


      <wsdl:input message="tns:getUserListRequest" />


      <wsdl:output message="tns:getUserListResponse" />


    </wsdl:operation>


    <wsdl:operation name="changeUserPassword">


      <wsdl:documentation>Enter description here...</wsdl:documentation>


      <wsdl:input message="tns:changeUserPasswordRequest" />


      <wsdl:output message="tns:changeUserPasswordResponse" />


    </wsdl:operation>


    <wsdl:operation name="changeUserData">


      <wsdl:documentation>Enter description here...</wsdl:documentation>


      <wsdl:input message="tns:changeUserDataRequest" />


      <wsdl:output message="tns:changeUserDataResponse" />


    </wsdl:operation>


    <wsdl:operation name="changeUserName">


      <wsdl:documentation>Change the username by iduser</wsdl:documentation>


      <wsdl:input message="tns:changeUserNameRequest" />


      <wsdl:output message="tns:changeUserNameResponse" />


    </wsdl:operation>


    <wsdl:operation name="addUser">


      <wsdl:documentation>Enter description here...</wsdl:documentation>


      <wsdl:input message="tns:addUserRequest" />


      <wsdl:output message="tns:addUserResponse" />


    </wsdl:operation>


    <wsdl:operation name="getUser">


      <wsdl:documentation>


      </wsdl:documentation>


      <wsdl:input message="tns:getUserRequest" />


      <wsdl:output message="tns:getUserResponse" />


    </wsdl:operation>


    <wsdl:operation name="getProfileList">


      <wsdl:documentation>Enter description here...</wsdl:documentation>


      <wsdl:input message="tns:getProfileListRequest" />


      <wsdl:output message="tns:getProfileListResponse" />


    </wsdl:operation>


  </wsdl:portType>


  <wsdl:binding name="UsersoapControllerBinding" type="tns:UsersoapControllerPortType">


    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />


    <wsdl:operation name="login">


      <soap:operation soapAction="urn:UsersoapControllerwsdl#login" style="rpc" />


      <wsdl:input>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:input>


      <wsdl:output>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:output>


    </wsdl:operation>


    <wsdl:operation name="getUserList">


      <soap:operation soapAction="urn:UsersoapControllerwsdl#getUserList" style="rpc" />


      <wsdl:input>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:input>


      <wsdl:output>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:output>


    </wsdl:operation>


    <wsdl:operation name="changeUserPassword">


      <soap:operation soapAction="urn:UsersoapControllerwsdl#changeUserPassword" style="rpc" />


      <wsdl:input>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:input>


      <wsdl:output>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:output>


    </wsdl:operation>


    <wsdl:operation name="changeUserData">


      <soap:operation soapAction="urn:UsersoapControllerwsdl#changeUserData" style="rpc" />


      <wsdl:input>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:input>


      <wsdl:output>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:output>


    </wsdl:operation>


    <wsdl:operation name="changeUserName">


      <soap:operation soapAction="urn:UsersoapControllerwsdl#changeUserName" style="rpc" />


      <wsdl:input>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:input>


      <wsdl:output>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:output>


    </wsdl:operation>


    <wsdl:operation name="addUser">


      <soap:operation soapAction="urn:UsersoapControllerwsdl#addUser" style="rpc" />


      <wsdl:input>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:input>


      <wsdl:output>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:output>


    </wsdl:operation>


    <wsdl:operation name="getUser">


      <soap:operation soapAction="urn:UsersoapControllerwsdl#getUser" style="rpc" />


      <wsdl:input>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:input>


      <wsdl:output>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:output>


    </wsdl:operation>


    <wsdl:operation name="getProfileList">


      <soap:operation soapAction="urn:UsersoapControllerwsdl#getProfileList" style="rpc" />


      <wsdl:input>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:input>


      <wsdl:output>


        <soap:body use="encoded" namespace="urn:UsersoapControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />


      </wsdl:output>


    </wsdl:operation>


  </wsdl:binding>


  <wsdl:service name="UsersoapControllerService">


    <wsdl:port name="UsersoapControllerPort" binding="tns:UsersoapControllerBinding">


      <soap:address location="http://localhost/pruebaYii/index.php?r=usersoap/index&amp;ws=1" />


    </wsdl:port>


  </wsdl:service>


</wsdl:definitions>


It seems the problem IS because of the failure to read the namespace http://schemas.xmlso…/soap/encoding/ which is defined as soap-enc and used in array definition as “soap-enc:Array”.

The WSDL itself should be fine.