User Tools

Site Tools


en:wiki:3.-servidor:3.13.-conectores-online:start

Obtaning data online

The XOne platform, as a rule, operates with a local database on the device, so that even if there is no data connection, we can work with the application at all times.

This does not imply that you always have to work “OFF-LINE”, it is the most comfortable and fastest way to work with a device, but the technology also allows us to create collections “ON-LINE” to recover certain data or even create the complete application “ON-LINE” if necessary.

  1. The name of the connection nodes must be unique for the whole mappings.xml, even if they are in different collections. If they can be defined in any collection, to have all the connections located, the best is define them in the app node at the beginning of the mappings.
  2. All the collections ONLINE load the data with LOADALL, the data CANNOT be browsed with STARTBROWSE.

In the XOne Platform, we have several ways to connect to get remote data:

Name Online Connection Connection Server Connection to ERP Client Platforms
JSONBD Intermediate Proxy that returns JSON Connection to BD Android, IOS, W8 (Under development)
JSONWS Intermediate Proxy that returns JSON Connection to Web Service Android, IOS, W8 (Under Development)
XOneOnline Intermediate Proxy that returns XML Connection to BD Android, IOS, Windows Mobile, BlackBerry
XOneDirect Direct to Web Services of the client Web Services of the client Android, IOS (Under Development)



NODO connection in mappings

In the ONLINE connections, we need to have a connection node with the connection string to the intermediate Proxy, or Web Service from we will get the data.

Parameters connection Description
name Must be unique in the WHOLE mappings.
connstring Call to Proxy or Web Service which we are going to connect to, by giving it different parameters:


Parameters Value
Provider XOne Remote Provider. This value must be always like that, since it is from system.
Data Source Name of the web service which we call to.
NameSpace Name we get from the WSDL of the targetNamespace attribute.
ProgID Name of the progID used by the machinery, the values are:


Parameters Value
com.xone.db.soa.SOAConnection Used to run directly to the web service from the frame.
com.xone.db.json.JSONConnection Used to connect to the web service through proxy JSON.
CGSProxy.CProxy Used to connect with generic proxy that returns XML, to the web services.
Timeout Waiting time for a response before giving error. (In seconds)
Security Level Security type (Numeric). Depending on the proxy used.
method The method to get the data from the Proxy, GET or POST.


Proxy JSONBD


Proxy that will run the client´s database and will return the results in JSON way to the XOne Framework. (Faster than the former method of ONLINE collections that XML did return. ).

The latest version of the proxy can be obtained by downloading it from the web XOneSupport.


Web.Config de JSONBD


Within the Web.Config file of the proxy, we have the appSettings node:

<appSettings>
	<add key="debug" value="true"/>
	<add key="Connection String" value="Provider=System.Data.SqlClient;Data Source=AQUI LA CADENA DE CONEXION A LA BASE DE DATOS;"/>
	<add key="Security Level" value="0"/>
	<add key="Database Operations Allowed" value="select,insert,delete,update"/>
</appSettings>


PARAMETERS OF THE APPSETTINGS NODE VALUES
debug true - false
Log is left in the events display.
Connection String Connection String to the Database.
Security Level 0 - 1 - 2 - 3
0.- Without Security. The call is processed as is.
1.- Security with http header authentication. The user and password are sent to compare in local.
2.- By session maintenance. We need a session token that the server sends when it is authenticated.
3.- By certificate. (Under development).
Database Operations Allowed select - insert - delete - update
Operations allowed at the time to work with the Database.



Example of JSONBD type


<!-- ########################## LLAMADA ONLINE ENTRE FRAMEWORK___PROXY JSON_BASE DE DATOS  ############################# -->
<coll name="MapaReservas" fontsize="8" title="MapaReservas" objname="MapaReservas" updateobj="MapaReservas" progid="ASData.CASBasicDataObj" 
sql="SELECT t1.ID,t1.CODEDIFICIO,t1.CODPLANTA,t1.CODSALA,t1.DATE_START,t1.CAPACIDAD,t1.MATRIZ
	FROM gen_MapaReservas t1" filter="" sort="DATE_START limit 50" connection="mapa" userawsql="true">
 
	<!-- Aqui lo dividimos en 2 líneas para que se vea mejor el ejemplo, DEJAR EN UNA SOLA LINEA. -->
	<connection name="mapa" connstring="Provider=Xone Remote Provider;Data Source=http://xone.es/XoneJSONReservaSalas/Default.aspx;
	ProgID=com.xone.db.json.JSONConnection;Timeout=60;Security Level=0" />
 
	<group name="General" id="1" />
	<prop name="CODEDIFICIO" type="T" visible="0" group="1" />
	<prop name="CODPLANTA" type="T" visible="0" group="1" />
	<prop name="CODSALA" type="T" visible="0" group="1" />
	<prop name="DATE_START" title="F.Inicio" type="D" visible="1" group="1" />
	<prop name="CAPACIDAD" title="Capacidad" type="N" visible="1" group="1" />
	<prop name="MATRIZ" title="Matriz" type="T" visible="1" group="1" />
</coll>


PARAMETER OF THE MAPPINGS REMARKS
sql Same as ever, as if it were OFFLINE, the difference is that the SQL is executed in a remote DB.
filter and sort As always, the WHERE and the ORDER BY of the SQL sentence.
connection Value of the name attribute of the connection node defined further on.
userawsql In order the framework do not try to parse the SQL and puts it in a sub query way, just leave it as it is in the SQL attribute.
loadall Put to “true”. All the ONLINE collections load the data with LOADALL, the data cannot be browsed with STARTBROWSE.



Proxy JSONWS


Proxy that will run the Web Services of the client and will return the results in JSON way to the XOne framework. (Faster than the former method of ONLINE collections that XML did return. ).

The latest version of the Proxy can be obtained by downloading it from the web XOneSupport.



Web.Config of JSONBD


Within the Web.Config file of the proxy, we have the appSettings node:

<appSettings>
	<add key="debug" value="true"/>
	<add key="Connection String" value="Provider=System.Data.SqlClient;Data Source=AQUI LA CADENA DE CONEXION A LA BASE DE DATOS;"/>
	<add key="Security Level" value="0"/>
	<add key="Database Operations Allowed" value="select,insert,delete,update"/>
</appSettings>


PARAMETERS OF THE APPSETTINGS NODE VALUES
debug true - false
Log is left in the events display.
Connection String Connection string to the Database.
Security Level 0 - 1 - 2 - 3
0.- Without Security. The call is processed as is.
1.- Security with http header authentication. The password and user are sent to compare in local.
2.- By session maintenance. A session token is needed that the server sent when it is authenticated.
3.- By certificate. (Under development).
Database Operations Allowed select - insert - delete - update
Operations allowed at the time to work with the dabatase.



Example of JSONBD type


<!-- ########################## LLAMADA ONLINE ENTRE FRAMEWORK___PROXY JSON_BASE DE DATOS  ############################# -->
<coll name="MapaReservas" fontsize="8" title="MapaReservas" objname="MapaReservas" updateobj="MapaReservas" progid="ASData.CASBasicDataObj" 
sql="SELECT t1.ID,t1.CODEDIFICIO,t1.CODPLANTA,t1.CODSALA,t1.DATE_START,t1.CAPACIDAD,t1.MATRIZ
	FROM gen_MapaReservas t1" filter="" sort="DATE_START limit 50" connection="mapa" userawsql="true">
 
	<!-- Aqui lo dividimos en 2 líneas para que se vea mejor el ejemplo, DEJAR EN UNA SOLA LINEA. -->
	<connection name="mapa" connstring="Provider=Xone Remote Provider;Data Source=http://xone.es/XoneJSONReservaSalas/Default.aspx;
	ProgID=com.xone.db.json.JSONConnection;Timeout=60;Security Level=0" />
 
	<group name="General" id="1" />
	<prop name="CODEDIFICIO" type="T" visible="0" group="1" />
	<prop name="CODPLANTA" type="T" visible="0" group="1" />
	<prop name="CODSALA" type="T" visible="0" group="1" />
	<prop name="DATE_START" title="F.Inicio" type="D" visible="1" group="1" />
	<prop name="CAPACIDAD" title="Capacidad" type="N" visible="1" group="1" />
	<prop name="MATRIZ" title="Matriz" type="T" visible="1" group="1" />
</coll>


PARAMETERS OF THE MAPPINGS REMARKS
sql Same as ever, as if it were OFFLINE, the difference is that the SQL is executed in a remote DB.
filter and sort As always, the WHERE and the ORDER BY of the SQL sentence
connection Value of the name attribute of the connection node defined below.
userawsql In order the framework do not try to parse the SQL and puts it in sub query way, just leave it as it is in the SQL attribute.
loadall Put to “true”. All the ONLINE collections load the data with LOADALL, the data CANNOT be browsed with STARTBROWSE.



Proxy JSONWS


Proxy that will run the Web Services of the client and will return the results in JSON way to the XOne Framework. (Faster than the former method of ONLINE collections that XML did return. ).

The latest version of the Proxy can be get by downloading it from the web XOneSupport.


Example of JSONWS type

<!-- ########################### LLAMADA ONLINE ENTRE FRAMEWORK___PROXY JSON_WEBSERVICE  ##############################
    Coleccion online para llamar al Web Service a partir del Proxy.
    En Android: se le puede indicar el endpoint, ya que se puede tener un único proxy llamando a varios WebService.  
    Lo que hace la llamada es en el SQL se le pone a que opción del web service se llama, que en el ejemplo es CheckLic2 y en el
    filter se pasan los parametros que pueda permitir el webservice.
-->
<coll name="CheckLic2" title="CheckLic" objname="CheckLic" updateobj="CheckLic" progid="ASData.CASBasicDataObj" 
	sql="SELECT * FROM CheckLic" filter="stPIN=355136053971720" sort="" connection="CheckLic2" loadall="true">
	<connection name="CheckLic2" connstring="Provider=Xone Remote Provider;Data Source=http://xoneisp.com/XoneJSONWebService/;endpoint=xoneisp.com;ProgID=com.xone.db.json.JSONConnection;Timeout=60;Security Level=0" />
	<group name="General" id="1" />
	<prop name="Result" type="T" visible="7" group="1" />
</coll>


Web.Config of JSONWS


Within the Web.Config file of the proxy, we have the appSettings and client nodes:

<appSettings>
	<add key="debug" value="true"/>
 
    <!-- Direccion del WSDL del Web Service al que nos tenemos que conectar si solamente tiramos contra un web service -->
	<add key="EndPoint" value="http://www.cgsoft.net/geoipservice.asmx?WSDL"/>
	<add key="Class" value="GeoIPServiceSoapClient"/>
    <!-- 	 -->
 
    <!-- Direcciones WSDL de los Web Services a los que queramos conectar en caso de que tiremos contra varios web services,
         desde un mismo proxy -->
	<add key="EndPoint(xoneisp.com)" value="http://xoneisp.com/Xonelive/xonelivews.asmx?wsdl"/>
	<add key="Class(xoneisp.com)" value="ServiceSoapClient"/>
 
	<add key="EndPoint(xone.es)" value="Http://xone.es/services/listadatos.asmx?WSDL"/>
	<add key="Class(xone.es)" value="listadatosSoapClient"/>
    <!-- 	 -->
 
	<add key="Security Level" value="0"/>
</appSettings>
.....
.....
.....
<client>
      <endpoint address="http://www.cgsoft.net/geoipservice.asmx" binding="basicHttpBinding"
        bindingConfiguration="httpbinding" contract="GeoIPServiceSoap"
        name="GeoIPServiceSoap" />
 
      <endpoint address="http://xoneisp.com/Xonelive/xonelivews.asmx" binding="basicHttpBinding"
        bindingConfiguration="httpbinding" contract="ServiceSoap"
        name="ServiceSoap" />
 
      <endpoint address="http://xone.es/services/listadodatos.asmx" binding="basicHttpBinding"
        bindingConfiguration="httpbinding" contract="listadatosSoap"
        name="listadatosSoap" />
</client>


PARAMETERS OF THE APPSETTINGS NODE VALUES
debug true - false
Log is left in the events display.
EndPoint

WSDL address of the WEB Service which we have to connect to. i.e.: http://www.cgsoft.net/geoipservice.asmx?WSDL

If we are going to call to different WEB SERVICES from the proxy, we have to put EndPoint(whatever), being the value in brackets the value of the “endpoint=Loquesea;” attribute, specified in the call of the mappings.xml to call to a Web Service or to another one.

Example of call to web service in mappings.xml:

<connection name="CheckLic2" 
connstring="Provider=Xone Remote Provider;Data Source=http://xoneisp.com/XoneJSONWebService/;endpoint=xoneisp.com;
ProgID=com.xone.db.json.JSONConnection;Timeout=60;Security Level=0" /> 
Class Es la clase del WSDL. La misma se obtiene al final del WSDL, en el apartado wsdl:service name=“Service” (Normalmente hay 2 en el WSDL, cogemos el primero de ellos) y se le añade “Client” al final, por ejemplo, para <wsdl:port name=“ServiceSoap”… > el Class sería “ServiceSoapClient
Security Level 0 - 1
0.- Sin seguridad. La llamada se procesa tal cual.
1.- Seguridad con http header authentication. Se envía el usuario y la contraseña para comparar en local. La Seguridad por cabecera debe de tenerlo implementado el web service que sea.


PARAMETERS OF THE CLIENT NODE VALUES
address The web service address. (WITHOUT the ?wsdl at the end of the address. )
contract The wsdl contract that there is at the end of it, within the section wsdl:service name=“Service”
name
en/wiki/3.-servidor/3.13.-conectores-online/start.txt · Last modified: 2018/01/10 13:28 (external edit)