{{indexmenu_n>1}} ===== 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. - 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.\\ - 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: |< 80% 20% 25% 25% 30% >| ^ 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.\\ {{ :b.-programacion:colecciones_online:coll_online_json_bd.png?nolink }} \\ === Web.Config de JSONBD === \\ Within the Web.Config file of the proxy, we have the //appSettings// node: \\ |< 100% 20% 80% >| ^ 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 === \\ \\ |< 100% 20% 80% >| ^ 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.\\ {{ :b.-programacion:colecciones_online:coll_online_json_web_services.png?nolink }} \\ \\ === Web.Config of JSONBD === \\ Within the Web.Config file of the proxy, we have the appSettings node: \\ |< 100% 20% 80% >| ^ 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 === \\ \\ |< 100% 20% 80% >| ^ 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.\\ {{ :b.-programacion:colecciones_online:coll_online_json_web_services.png?nolink }} \\ === Example of JSONWS type === \\ === Web.Config of JSONWS === \\ Within the Web.Config file of the proxy, we have the **appSettings** and **client** nodes: ..... ..... ..... \\ |< 100% 20% 80% >| ^ 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: | | **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 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** | It is indicated the same one than the contract. | \\ \\ ==== XOneOnline ==== Old way to made the ONLINE connections, that did return the data in XML format. \\ \\ {{ :b.-programacion:colecciones_online:coll_online_xml_bd.png?nolink }} \\ \\ === Example of XOneOnline code === \\ * 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 COLL node level, we have a parameter **connection="proyecto_online1"** which is the one that specifies that the collection is an **ONLINE** collection. * Finally, we have the **** node, which will be where is defined the connection with the web service which the collection is going to work with. MUY IMPORTANTE, **the value of this attribute must be unique for the whole mappings**. The answer of the **WebService** must be something like this: \\