Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Problem with soapval and anyType

Help
2011-09-02
2013-06-06
  • I have this code:

      $data = array(
                'slaveId'=>2,
                'name'=>'created data source',
                'pollingPeriod'=>32423,
                'timeout'=>3432,
                'retries'=>4,
                'contiguousBatches'=>34,
                'createSlaveMonitorPoints'=>0,
                'serialPort'=>3,
                'baudRate'=>2,
                'enabled'=>true
            );
            $data = array_merge($data, array('id'=>-1));
            debug($data);
            $result = $this->oSoapClient->call("configureDataSource", array(
                'ConfigureDataSourceParams'=>array(
                    'type'=>'MODBUS_SERIAL',
                    'dataSource'=> new soapval(
                            'dataSource', 
                            'ModbusSerialConfig', 
                            $data, 
                            false, 
                            'http://www.w3.org/2001/XMLSchema'
                    )
                )
            ));
            debug($this->oSoapClient->request);
            return $result;
    

    and this result:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns7902="http://tempuri.org">
    <SOAP-ENV:Body>
    <ConfigureDataSourceParams xmlns="http://config.api.scadabr.org.br">
    <type>MODBUS_SERIAL</type>
    <dataSource xsi:type="xsd:ModbusSerialConfig">
    [b]Array[/b]
    </dataSource>
    </ConfigureDataSourceParams>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    Look at the 'Array' part. It seems that is not serializing my classes. What I'm doing wrong?

    By the way the server response is throwinng an error too:

    [faultcode] => soapenv:Server.userException
    [faultstring] => org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}ModbusSerialConfig