Help save net neutrality! Learn more.
Close

Which soapval for an empty array ?

Help
ecor6633
2008-09-11
2013-06-06
  • ecor6633

    ecor6633 - 2008-09-11

    Hello,
    I'm developing a web service in php to be used in .Net C#program.

    I defined a complexType called Champ and a array of Champ[] called Champs like that :
        /* ############ Définition d'un champ */
        $server->wsdl->addComplexType("Champ", "complexType", "struct", "sequence", "",
            array(
                "id"=>array("name"=> "id", "type"=>"xsd:int"),
                "colonne_id"=>array("name"=> "colonne_id", "type"=>"xsd:string"),
                "colonne"=>array("name"=> "colonne", "type"=>"xsd:string"),
                "ligne_id"=>array("name"=> "ligne_id", "type"=>"xsd:string"),
                "table"=>array("name"=> "table", "type"=>"xsd:string"),
                "type_champ"=>array("name"=> "type_champ", "type"=>"xsd:string"),
                "valeur"=>array("name"=> "valeur", "type"=>"xsd:string"),
                "commentaire"=>array("name"=> "commentaire", "type"=>"xsd:string"),
                "formulaire"=>array("name"=> "formulaire", "type"=>"xsd:string"),
                "activite_id"=>array("name"=> "activite_id", "type"=>"xsd:int")
            )
        );
        /* ###### Définition d'un array de champs */
        $server->wsdl->addComplexType("Champs", "complexType", "array", "sequence", "SOAP-ENC:Array", array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:Champ[]')), 'tns:Champ');
       
    Now i'm trying to send an empty array of champ so a kind of $champs = array();

    I already tried :
    return new soapval("return", "tns:Champs", null);
    return new soapval("return", "tns:Champs", array);
    return new soapval("return", "xsd:nil", null);

    But i only get message saying the xml send by nusoap is not a correct xml.

    What the solution to get an empty array ? is this possible ?

     
    • ecor6633

      ecor6633 - 2008-09-11

      Ok i apoloize, a part of the problem was a stupid "cut and paste". I haven't the same error now, i corrected the xml produced and in C# and when i send the soapva, i can get null. Which is much better than an exception.

      The question i still have is : would it be possible to get an empty array instead of null ?

       

Log in to post a comment.