Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »


Web Services Overview

Web services are software solutions that allow for interacting with machines residing on a network.  In short, web services are nothing more than web pages for machines. They provide a standard way for a third party to request and receive data from a piece of hardware on the network without having to know anything about how that machine works. 

There are two common approaches to Web Services in Ignition: making a HTTP (HyperText Transfer Protocol) method call, or making a SOAP (Simple Object Access Protocol) call.

HTTP methods, such as GET and POST, are called using the built-in system functions, such as system.net.httpGet

SOAP is XML based, and typically requires a 3rd party Python library, such as SUDS. Note that SOAP requests are still served over HTTP: the data is simply wrapped in XML, and the resulting implementation in Ignition differs from straight HTTP calls as a result. Making web services calls via SOAP involves the use of a WSDL (Web Services Definition Language), which is an XML document describing the web service that can be called from the server. 

The approach you choose typically depends on the server you're trying to make calls to.

One approach one common protocol is SOAP . Other programs interact with the service through an interface defined by a WSDL (Web Services Description Language) file.  This WSDL describes how to talk with the device and what should be expected back in response. Messages to and from the web service are formatted XML and while you need very little knowledge of XML to use the SUDS library, many times a web service will return a formatted XML string that you will have to parse through manually in order to make the data presentable.

What about REST?

REST is an architectural style, which differs from the protocols mentioned above. 

On this page ...

Common Web Services Workflow

While all Web Services follow the same standards, they all do different things. They wouldn't be worth anything if you didn't get the information you need, or if they contained a lot of excess data. If you are unfamiliar with a particular Web Service, there are a few things that you can do to figure out what data is available and how to get it.

  1. Identify a Web Service that you will be using. 
  2. Write a script to pull the WSDL from the Web Service.
  3. From the WSDL, identify the functions you want to use and what arguments it expects.
  4. Write a script to use that function and return your values.
  5. Parse the results and use them. This can be for display, saving to a database, or anything else you need.

Note: web services sometimes take a lot of time to return results, especially the first time they are called. If you put your Web Services script in a button, the client will freeze until the call is complete (this is because the event handlers are run on the GUI thread). It's a good idea to use system.util.invokeAsynchronous() or add a waiting image to your screen to let the user know Ignition is working as expected.

See Overview & Simple Arguments to get started.

 



  • No labels