XOne Platform, by general rule, operates with a local database at the device, so that, although there is no data connection, we can work at any time with the application.

This does not entail that always we have to work “OFF-LINE”, it is the most comfortable and fast way for working with a device, but technology also allows us to create “ON LINE” collections to recover certain data or even creating “ON LINE” the full application if it was necessary.

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


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

Online Connection Name Connection Server Clients ERP Connection Platforms
JSONBD Intermediate Proxy intermedio that JSON returns DB Connection Android, IOS, W8 (Under development)
JSONWS Intermediate Proxy that JSON returns Web Service Connection Android, IOS, W8 (Under development)
xoneonline Intermediate Proxy that XML returns DB Connection Android, IOS, Windows Mobile, blackberry
xonedirect Direct to Web Services of the client Web Services of the client Android, IOS (Under development)



At the ONLINE collections, we must have a connection node with the connection string to the intermediate Proxy, or Web Service from we will get the data.


Connection Parameters Description
name It must be unique in the WHOLE mappings.
connstring Call to the Proxy or Web Service to which we are going to connect, by passing it several parameters:
-Provider :Xone Remote Provider. This value must be always like that, since it is of system.
-Data Source:Web service name which we call to.
-namespace: Name we get from the WSDL of the targetNamespace attribute.
-progid:progID name used by the machinery, the values are:
-1.com.xone.db.soa.SOAConnection: Used to attack directly to the web service from the frame.
-2.com.xone.db.json.JSONConnection:Used to connect to the web service through´ the proxy JSON.
-3.CGSProxy.CProxy :Used to connect with generic proxy that returns XML, to the web services.
Timeout Waiting time of an answer before it fails. (In seconds)
Security Level Type of security (Numeric). Depending on the proxu used.
method The method to get the data from the Proxy, GET or POST.



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

The last version of the Proxy can be obtained by downloading it from the web xonesupport.


JSONDB Web.Config


Within the Web.Config file from the proxy, we find 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>


appSettings node Parameters Values
debug true - false
It leaves log at the events viewer.
Connection String Connection string to the DataBase.
Security Level 0 - 1 - 2 - 3
0.- Without security. The call is processed as it is.
1.- Security with http header authentication. The user and password is sent to compare in local.
2.- By session maintenance. A session token is needed that the server sends when it is authenticated.
3.- By certificate. (Under development).
Database Operations Allowed select - insert - delete - update
Oerations allowed at the time to work with the Database.


Example of the JSONDB 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>


Mappings Parameter Remarks
sql Same than always, as if it were OFFLINE, the difference is that the sql is executed in a remote DB.
filter and sort As usual, 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 the form of a subquery, just leave it as it is in the SQL attribute.
loadall Putting to “true”. All the ONLINE collections load the data with LOADALL, the data cannot be browsed with STARTBROWSE.



Proxy that will attack the client´s Web Services and will return the results in form of JSON to the XOne Framework. (Más rápido que el antiguo método de colecciones ONLINE que devolvía XML).

The last version of the Proxy can be obtained by downloading it from the web xonesupport.


Example of the type JSONWS


<!-- ########################### 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>


JSONWS Web.Config


Within the Web.Config file of the proxy, we can find 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>


appSettings node Parameters Values
debug true - false
Log is left in the events viewer.
endpoint

WSDL address of the Web Service which we have to connect to. E.g: http://www.cgsoft.net/geoipservice.asmx?WSDL

If different Web Services are going to be called from the proxy, we have to put endpoint(whatever), being the value in parentheses the value of the attribute “endpoint=whatever;” by specifying in the call of the mappings.xml to call to a Web Service or 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 It is the WSDL class. It is get at the end of the WSDL, at the section wsdl:service name=“Service” (Usually, there is 2 in the WSDL, we take the first of them) and we add at the end “Client” , for instance, to <wsdl:port name=“servicesoap”… > the Class would be: “servicesoapclient
Security Level 0 - 1
0.- Without security. The call is processed as it is.
1.- Security with http header authentication. The user and the password is sent to compare in local. The Security by heading must have it implemented the web service that is.
Client node Parameters Values
address The web service address. (WITHOUT the ?wsdl at the end of the address)
contract The WSDL contract that is at the end of itself, within the section wsdl:service name=“Service”
name It is indicated the same one than the contract.



Old way to make the ONLINE connections, that did return the data in XML format.


Example of XOneOnline code


<coll name="VisitasOnline" title="VisitasOnline" fontsize="8" progid="ASData.CASBasicDataObj"
	objname="" updateobj="" sql="SELECT t1.* FROM ##PREF##kk t1"
	connection="proyecto_online1" cache="false" loadall="true" useextdata="true" stringkey="true" idfieldname="SECUENCIA" check-owner="false" >
 
	<connection name="proyecto_online1" connstring="Provider=CGSoft Remote Provider;Data Source=http://123.123.123.123/Proxy/Default.aspx?;ProgID=CGSProxy.CProxy;appname=CGMobile;Timeout=60;network=0"/>
 
	<group name="General" id="1"/>
	<prop name="ID" visible="7" group="1" type="N" fieldsize="10"></prop>
	<prop name="SECUENCIA" visible="7" group="1" type="N" fieldsize="10"></prop>
	<prop name="STATUS" visible="7" group="1" type="N" fieldsize="10"></prop>
	<prop name="ERRDESC" visible="7" group="1" type="T" fieldsize="40"></prop>
</coll>


  • The sql of the collection: “SELECT t1.* FROM ##PREF##kk t1” IT IS USELESS, and both objname and updateobj are empty, since we are NOT going to deal with a local Database.
  • At a level of COLL node, we have a parameter connection=“proyecto_online1 that is the one which specifies that the collection, is an *ONLINE collection. * Later, we have the <connection name=”proyecto_online1” …> node, which will be where the connection will be really defined with the webservice which the collection is going to work with. MUY IMPORTANTE, the value of this attribure must be unique for the whole mappings**.


The answer of the webservice must be something like this:

<xml>
  <R>
    <F N="SECUENCIA" T="T" V="9482e7e4-fee3-4a7a-8e1f-6e5b0e294b54" />
    <F N="STATUS" T="N" V="0" />
    <F N="ERRDESC" T="T" V="Parametros incompletos" />
  </R>
</xml>