Without authentication
Contents
In general when connecting to web services, you use the HTTP API to pull or push the data. The XML or JSON API can be very useful to parse or generate data.
Steps
To Pull data from a web service
- Pull data using
net.http.get{}
ornet.http.post{}
- Parse the data
- Process the data
- Forward the data to a database, file, web server, LLP, onto the queue, etc
To Push data to a web service
- Generate the data
- Push the data using
net.http.put{}
Example
Try the Hello World web service, no authorization is needed.
In this case we get the data with net.http.get{}.
Then we parse it with xml.parse{}
, and finally we push the parsed data onto the queue for later processing.
To run the example:
- Create a From Translator –> To Channel channel
- Copy the code snippet into the From Translator script
URL = 'http://example.interfaceware.com:6544/hello' function main() -- get data from web service local R = net.http.get{url=URL, live=true} -- parse and extract data local X = xml.parse{data=R} -- add data processing here -- push the result to the queue queue.push(X.text[1]:nodeValue()) end
Continue: Using basic authentication