Hi! I want to enable / disable datasource from the WSDL API, but there’s no examples of the config methods in the Wiki. I think that the method “ConfigureDataSource” should do the trick but I don’t know what should I pass it as parameters:
Where can I find information about this method? Or should I check the sources?
I would love to be able to add datasources and datapoints from the API too :P. Well if there’s not such method in the project I’m interested in developing that (because I need that).
You could use a script to enable/disable the datapoints/datasources you want and then use a buttom to fire the script trough the API.
The problem is that data in database is saved in binary, so I can’t modify that data through SQL in my own application. I want to know if already exists a method for enable / disable / create datapoints / datasources or if I have to create them. If they already exists, I would love to know how to use it, but I didn’t find any example in documentation.
hello spirit
1st you might check the demo “ClienteJavaWeb” which demonstrates almost the full API, including configuredatasource and configuradatapoints. It comes “pre-shipped” with the windows installer (http://localhost:8080/ClienteJavaWeb/) and its sources are in SVN. maybe that can be a starting point; One of the required parameters is an id for the datasource/point you wish to configure, passing “-1” would ADD it instead of CONFIGURE’ing it.
if you find trouble in studying that examples please tell us, then we could maybe get better documentation.
I’m not sure, though, that you can enable/disable the datapoints or just add/configure them, please check that too.
2nd if you need only to enable/disable points and sources “programatically” but could do it from inside scadabr (not necessarily from the api), our “scripting” functionality could do that. you can write a script which disables or enables datapoint and sources by their XID, then schedule this script to run periodically, or display a button to run that script in graphical views. If that would be an option to you please tell us then we can provide more details.
thanks for using scadabr
I need to enable / disable from the API, but the configure method seems to be what I need :).
I forgot to mention that I’m using a PHP client with nusoap. This is my call, using the ‘configureDataSource’ method:
$data = array(
‘slaveId’=>2,
‘name’=>‘created data source’,
‘pollingPeriod’=>32423,
‘timeout’=>3432,
‘retries’=>4,
‘contiguousBatches’=>34,
‘createSlaveMonitorPoints’=>0,
‘serialPort’=>3,
‘baudRate’=>2,
‘enabled’=>true
);
return $this->oSoapClient->call("configureDataSource", array(array(
'type'=>'MODBUS_SERIAL',
'dataSource'=>array_merge($data, array('id'=>-1))
)));
And this is the response:
Array
(
[faultcode] => soapenv:Server.userException
[faultstring] => org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
[detail] => Array
(
[hostname] => bizancio-Aspire-5720Z
)
)
I think the problem is I don’t really know what is the xml that is being generated (in both cases, in Java Client but also in my own PHP client :P).
hola spirit
voy intentar un poco de espanol, asi creo que mas brasilenos puedan compreender,
pero mi espanol no va muy perfecto
usted ha seguido los samples en \program files\scadabr\samples\PHP ?
buen, estos samples indican un wsdl “generado automaticamente” que es http://[ip-address]:8080/ScadaBR/services/API?wsdl
puedes de otro modo, intentar cargar un wsdl-file especifico que ha sido “hecho a mano” que es grabado en
\Program Files\ScadaBR\webapps\ScadaBR\wsdl\API.wsdl
copialo para el directorio de tu aplicacion PHP e utilize
$wsdl = 'API.wsdl';
en el lugar de
$wsdl = 'http://[ip-address]:8080/ScadaBR/services/API?wsdl';
puedes tambien editar API.wsdl e cambiar
location=“http://localhost:8080/ScadaBR/services/API”/
para utilizar el ip-address real del servidor en lugar de localhost, se quieres acessar en uno servidor remoto.
hay unas pocas diferenzas en los dos wsdls, vamos a ver se esto wsdl desarrollado manualmente causa los mismos errores?
abrazos
Perfecto
Me gustaría intentar lo que me estás diciendo. Estoy usando Linux (Ubuntu), ¿puedo encontrar ese WSDL en la instalación de Linux? ¿o quizás en el SVN o en la Wiki?
Abrazos!
Hola,
si, el wsdl es encontrado en la instalacion de Linux, bajo el directorio webapps/ScadaBR/wsdl/
el directorio webapps es incluso en la instalacion de ScadaBR (o de apache-tomcat, se hiciste una instalacion manual).
en SVN, el API.wsdl:
http://scadabr.svn.sourceforge.net/viewvc/scadabr/ScadaBR/WebContent/wsdl/API.wsdl?revision=1159&view=markup
en SVN, los samples (incluso PHP):
http://scadabr.svn.sourceforge.net/viewvc/scadabr/Instalador%20Win32/Samples/
abrazo
No pude encontrar samples para PHP del método configureDataSource en el svn. Sigo teniendo errores. El problema antes era el anyType, que tenía que usar la función soapval para especificar el tipo de parámetro que estaba mandando. Sin embargo:
$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',
array()
)
)
));
No funciona. El WSDL generado no serializa el array y en ‘dataSource’ pone un string ‘Array’. Muy extraño. Por otro lado, la respuestaq del servidor es:
[faultcode] => soapenv:Server.userException
[faultstring] => org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}ModbusSerialConfig
Ohh necesito ayuda xD. Es lo último que me falta. Alguien hizo funcionar el configureDataSources con nusoap u otra librería PHP?