creating a service in warewolf in just a few quick steps!

16
Creating a Service

Upload: warewolf

Post on 09-Apr-2017

401 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Creating a service in Warewolf in just a few quick steps!

Creating a Service

Page 2: Creating a service in Warewolf in just a few quick steps!

1. If you hover over the top button labeled New, the New Service hint appears.

Click this button to create a new microservice

Page 3: Creating a service in Warewolf in just a few quick steps!

2. Let’s save our Microservice and call it DiceRoll

Simply type in the name “DiceRoll” and Click on Save

Page 4: Creating a service in Warewolf in just a few quick steps!

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.

Page 5: Creating a service in Warewolf in just a few quick steps!

If you look at the URL at the top of the Design Surface you’ll see it is now DiceRoll.json

Page 6: Creating a service in Warewolf in just a few quick steps!

Drag and drop the Random Tool from the Tool Box onto the Design Surface

Page 7: Creating a service in Warewolf in just a few quick steps!

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 

Page 8: Creating a service in Warewolf in just a few quick steps!

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.

Page 9: Creating a service in Warewolf in just a few quick steps!

  

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

Page 10: Creating a service in Warewolf in just a few quick steps!

Lets Run the Service!

Click on the Debug Button on the Main

Tool Bar

Page 11: Creating a service in Warewolf in just a few quick steps!

The Debug Dialog Box will appear

Click on View in Browser to view the output in the browser or

press F7

Page 12: Creating a service in Warewolf in just a few quick steps!

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.

Page 13: Creating a service in Warewolf in just a few quick steps!

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.

Page 14: Creating a service in Warewolf in just a few quick steps!

Click on Debug or F6 to view the output

You can also view the Output in the Warewolf Studio

Page 15: Creating a service in Warewolf in just a few quick steps!

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.