1

How to implement a web service with Platform

Тема: How to implement a web service with Platform

I need to create a web service to a platform called Centinela. Up to this moment, I have this code (código).

<?php

  require_once('lib/nusoap.php');

   $soapclient = new nusoap_client('http://lab.webservices.webmaps.com.mx/reportarEmergencia.php?wsdl', true);
   $result = $soapclient->call('reportar', array('key'      => 'cf56bd72c2cd127f5160ce73691daa2d',
                                                                             'folio'    => 0,
                                                               /* longitud*/ 'longitud' => -98.207990,
                                                                 /* latitud*/'latitud'  => 19.045235,
                                                             /*  (UTC) */'fecha'    => '2017-07-14 18:32:00',
                                                                   /* placa*/ 'placa'    => 'ABC 123',
                                                             /* modelo (UTC) */'modelo'   => 'Chevy',
                                                            /* modelo (UTC) */ 'color'    => 'Rojo'));
    print_r($result);

?>



But I have doubts as to connect with the server of wialon hosting and
I do not know if the data is sent by field, by parameter or by flag.

2

How to implement a web service with Platform

Re: How to implement a web service with Platform

desarrollosw, looks that you need to create an integration pushing to 3rd party platform some messages received by Wialon.
The simplest way to achieve this in PHP with minimal coding is to use next scheme.

1. Login on to flespi and in Telematics Hub section create channel with protocol "wialon_retranslator".
2. Create Retranslator in Wialon selecting protocol "Wialon Retranslator" and target as IP:port assigned to your flespi channel above. Select appropriate units and activate retranslator.
3. Now your flespi channel should receive information from Wialon, ensure that you receiving it by looking into channel's toolbox.
4. Basically here you can already request channel messages from your PHP script by using HTTP REST request. But in case oh PHP this should be implemented via job, may be you do not want it. In that case please follow next step.
5. Create flespi stream, selecting HTTP protocol and pointing it to URL of your PHP script. Do not forget to subscribe stream to the channel. You may also use stream's toolbox to diagnose its behavior.
6. Now your PHP script will be called by flespi via HTTP POST request with array of messages in JSON format received by Wialon. As long as you will reply with 2xx code flespi will send you new portion of messages. If something is wrong, reply with 4xx or 5xx code and flespi will retry retransmission to your server.

At the dark side of telematics...