creating a service in warewolf in just a few quick steps!
TRANSCRIPT
Creating a Service
1. If you hover over the top button labeled New, the New Service hint appears.
Click this button to create a new microservice
2. Let’s save our Microservice and call it DiceRoll
Simply type in the name “DiceRoll” and Click on Save
Your service will be saved into the Explorer
The Explorer shows you all of the saved resources on your Warewolf Server.
See DiceRoll which we just saved.
If you look at the URL at the top of the Design Surface you’ll see it is now DiceRoll.json
Drag and drop the Random Tool from the Tool Box onto the Design Surface
Configure the Random Tool on the Design surface
Our goal is to roll a dice, therefore the result we want is a random number in the range
between 1 and 6
Type is set to Numbers by DefaultRange 1 – 6Result = [[Result]]
When we run this configuration, it will select
a random number between 1 and 6 and insert the chosen number into the [[Result]]
variable.
You will notice that [[Result]] has square brackets. This is called a Variable in Warewolf
A Variable in Warewolf is a named value that can assume any value. Warewolf variables can be defined by adding a double square bracket at the beginning of a word, and a
double square bracket at the end of a word, like this [[variable]]. When you do this, Warewolf automatically
recognizes it as a variable.
We want our microservice to output the result of the dice
roll, so we need to flag the Result variable as
an Output, using the checkbox
Input variables are variables that need to be provided to
the service when it starts, and are used
to configure the state of the workflow.
Output variables are values produced as the end result of running the service
Lets Run the Service!
Click on the Debug Button on the Main
Tool Bar
The Debug Dialog Box will appear
Click on View in Browser to view the output in the browser or
press F7
By Default Warewolf outputs an XML Dataset.
Inside Datalist, you can see the output variable: Result In this case, <Result> is
returning a diceroll value of 3
If you refresh your browser, the value of <Result> changes randomly, and returns a
number between 1 and 6.
If you look at the URL in the browser address bar,
you can see that the microservice being called is
named DiceRoll.xml
If you change the .xml to .json, the Warewolf microservice will return
JSON data instead of XML, without any extra work on
your part. You can do this by
changing it in the browser address bar.
Click on Debug or F6 to view the output
You can also view the Output in the Warewolf Studio
By pressing Debug or F6 your Output is generated and the steps you have taken in your workflow are displayed in the Output box.
You can see the Name of the Service – DiceRollThe Step – RandomInputs – Numbers from 1 – 6Outputs - [[Result]] =6
If you press Debug again the [[Result]] will change as we are using the random tool.
Download WarewolfKnowledge Base
User Guide 1User Guide 2