Difference between revisions of "Incoming Web Service Requests Tutorial"

From PresenceWiki
Jump to: navigation, search
Line 1: Line 1:
 
{{Tutorials}}
 
{{Tutorials}}
  
This document gives a step-by-step guide to exposing a Presence [[Task]] as a [[Web Service]].
+
This document gives a step-by-step guide to exposing a Presence [[Task]] as a Web Service.
 +
 
 +
=== 1: Creating the Task ===
 +
 
 +
The first step is to create our Task. For the purposes of this demonstration we will create a Web Service that calculates the circumference of a circle given the radius. The Task to do this is very simple and comprises of:
 +
 
 +
# Start of Task Node
 +
# Require Variable Node - ${radius}
 +
# Set Variable Node - ${circumference}
 +
# End of Task Node
 +
 
 +
The variable ${radius} will be an incoming parameter and ${circumference} will be an outgoing parameter.
 +
 
 +
To calculate the circumference we call the following function in our Set Variable Node (3):
 +
 
 +
&eval {"2 * ${radius} * PI"}
 +
 
 +
Here is a view of the Task, which can be downloaded [http://www.international-presence.com/wikidocs/samples/calc_circumference.zip here]:
 +
 
 +
http://www.international-presence.com/wikidocs/images/calc_circumference_taskview.png
 +
 
 +
=== 2: Creating the Web Service ===
 +
 
 +
To expose our Task as a Web Service, first launch the [[Live Tasks Queue]]

Revision as of 14:19, 21 July 2010

Tutorial Pages > Incoming Web Service Requests Tutorial

This document gives a step-by-step guide to exposing a Presence Task as a Web Service.

1: Creating the Task

The first step is to create our Task. For the purposes of this demonstration we will create a Web Service that calculates the circumference of a circle given the radius. The Task to do this is very simple and comprises of:

  1. Start of Task Node
  2. Require Variable Node - ${radius}
  3. Set Variable Node - ${circumference}
  4. End of Task Node

The variable ${radius} will be an incoming parameter and ${circumference} will be an outgoing parameter.

To calculate the circumference we call the following function in our Set Variable Node (3):

&eval {"2 * ${radius} * PI"}

Here is a view of the Task, which can be downloaded here:

http://www.international-presence.com/wikidocs/images/calc_circumference_taskview.png

2: Creating the Web Service

To expose our Task as a Web Service, first launch the Live Tasks Queue