Note: The workflow sample mentioned in this article can be downloaded from the Opalis project on CodePlex: http://opalis.codeplex.com
A Workflow that demonstrates the use of the Invoke Web Services and Query XML Workflow Activities to interact with SOAP compliant Web Services.
This example submits city, country and state information to an online Web Service. The response is in the form of XML data that will be parsed to obtain the Latitude and Longitude of the place that was submitted. Another Web Service call is made to do the reverse: provide the Latitude and Longitude and parse the returned XML data to obtain the place.
Note: This example requires Internet connectivity.
This Workflow uses the Custom Start Activity to obtain input data using three parameters:
The Invoke Web Services Activity ‘Get Lat and Lon from Place’ subscribes to the variables from the Custom Start Activity to submit an XML Request Payload to the online Web Service using the ‘ConvertPlaceToLonLatPt’ method:
When submitting ‘Redmond’, ‘WA’, ‘USA’, the Activity returns following XML data as Published Data ‘XML Response Payload’:
The Query XML Activity ‘Get Lat’ subscribes to this data and uses an Xpath query ‘//Lat’ to obtain the value for Latitude:
The Query XML Activity ‘Get Lon’ subscribes to the same data and uses an Xpath query ‘//Lon’ to obtain the value for Longitude.
The Invoke Web Services Activity ‘Get Place from Lat and Lon’ subscribes to the results from both ‘Get Lat’ and ‘Get Lon’ Activities to invoke the ‘ConvertLonLatPtToNearestPlace’ method:
The Activity returns following XML data as Published Data ‘XML Response Payload’:
Redmond, Washington, United States
The Query XML Activity ‘Get Place’ subscribes to this data and uses an Xpath query ‘//ConvertLonLatPtToNearestPlaceResult’ to obtain the City, State and Country information:
The Send Platform Event Activity is used to display the resulting output:
Launch the Workflow by starting it from the Operator Console or by running it using the Testing Console. When prompted, enter the appropriate values:
Check the Operator Console Event screen or the Workflow Testing Console log to see the resulting output.
Refer to the Online Help for the Invoke Web Services and Query XML Activities.