This topic provides an overview of web services and their use with Logi applications.
The following sections are covered in this topic:
About Web Services
A Web Service is defined by the W3C as "a software system designed to support interoperable machine-to-machine interaction over a network". Web services are frequently just web-based APIs that can be accessed over a network and executed on a remote system hosting the requested services.
In common usage, "web service" refers to clients and servers that communicate using XML or JSON messages, following the SOAP or REST protocol standards. Logi Info uses XML as its underlying technology and is therefore well-suited to work with web services.
Logi Studio makes it easy to work with web services by doing some of the required legwork for you. For example, web services often provide a public Web Services Description Language (WSDL) file describing its methods. Logi Studio's wizards can read this file and the API methods and their parameters to you.
You may need to create an account in order to access a web service and some services may require that commercial users pay for the use of their service. Those activities and arrangements are beyond the scope of this topic.
To interact with REST-style web services from within a Process task, see Process Tasks.
In a Logi application, the same basic technique that's used for connecting to a database is used to connect to a web service: a Connection element. Special Connection elements are added to the _Settings definition to provide connectivity.
Connection.Web Service is used to connect to a SOAP-style web service and has an optional child element, Connector Property Parameters, which can be used handle special authentication and proxy settings for the connection.
Connection.REST is used to connect to a REST-style web service and has an optional child element, Request Header, which can be used (in multiples, if needed) to add special attributes and values to the request header sent in an HTTP communication with the service.
If you're connecting to your own web service using Connection.Web Service, the WSDL document specified in this connection element's required WSDL URL attribute must be "valid", meaning that it can contain no errors that would cause it to fail to compile. A document that's readable, but that will not compile, is invalid and will cause the connection to fail.
If you're trying to communicate with a web service that requires the TLS 1.1 or 1.2 protocol, you will need to use Logi Info v12.2-SP4 or later (earlier versions only support TLS 1.0). In addition, Info Java applications must use Oracle JDK 1.8 or OpenJDK 8 to make the protocol work.
Once defined, this connection is then referenced in other report definitions that wish to use the web service. The process is quick and easy.
The same basic technique that's used to retrieve data from a database is used to retrieve data from a web service. You use one of these special datalayer elements:
which in combination with the Connection mentioned earlier, receives the data retrieved from the web service. All of them have special child elements that can be used to pass parameters to the web service.
The last three are capable of retrieving the data by themselves, without the use of a Connection element, in certain circumstances.
All datalayers expect to receive data beginning with the relevant nodes. However, this may not always be the case: results may have additional parent nodes before the data. To deal with this, the datalayers have an XPath attribute where XPath queries can be entered for the purpose of selecting the desired data nodes for the datalayer.
Once data from the web service has been retrieved into a datalayer, then all of the usual Logi data handling (filtering, aggregating, etc.) and presentation elements can be applied to it.
XML vs JSON
The two primary web service return data formats are XML and JSON. XML long been a popular way to structure data using a familiar markup language. Despite its many advantages, one drawback of XML is its size: it contains many characters strictly related to formatting. When downloading data to a mobile device, it would be ideal to just obtain the relevant content instead of data related to content formatting. This is where JSON comes in.
Regardless of the data format returned by the web service you want to work with, Logi Info includes components for creating useful analyses.