warewolf user guide 2: sources and connectors · warewolf user guide 2: sources and connectors...
TRANSCRIPT
Warewolf User Guide 2: Sources and Connectors
Course Outline
Preparation for the Course
Getting help in Warewolf
Warewolf Syntax
Using Recordsets
Workflow Services
Calculations in Warewolf
The Warewolf Connector Tools and Sources
Sources identifier
The Web Service Tool
The Database Source
The DotNet DLL Source
The Server Dropdown List
Security
Server Permissions for a Group
Logging
Scheduling
Deploying
Service Discovery in Warewolf
APIs.json
Swagger
2 | P a g e
Warewolf User Guide 2 – Version 1.2
Preparation for the course
This course has been designed to be a hands-on training experience. We’ll guide you systematically
through exercises designed to enhance your understanding of how Warewolf works.
You will need the following to complete the course:
1. A laptop or PC (see system requirements below) with the latest version of Warewolf installed.
2. Access to a SQL Server 2008 database for the database exercises. If you are doing this course in
a classroom environment, we recommend being on a network, ideally with Internet access.
Course candidates can either work individually, or they can pair, sharing a computer.
3. Some of the content of the course is based around the Microsoft AdventureWorks 2008
database, so there needs to be at least one server in the classroom environment running SQL
Server 2008 or SQL server lite.
4. A notebook and pen to take notes.
You can download and install Adventureworks for your SQL server version from this site:
http://msftdbprodsamples.codeplex.com/
You can download the free Microsoft SQL Server 2008 Express edition from the following URL: http://www.microsoft.com/en-us/download/details.aspx?id=30438 If you are running on a LAN that is controlled by a network administrator, please confirm that your
workstations can access the SQL server.
Ideally, you should also have access to the following URL for one of the exercises:
https://www.google.com/
Let’s get started!
3 | P a g e
Warewolf User Guide 2 – Version 1.2
Getting help in Warewolf Warewolf has extensive help available for you.
(Figure 1)
Figure 1 highlights where you can find help in Warewolf.
1. Warewolf has context sensitive help for most items that you can click on that displays in the
window in the bottom left corner.
2. Warewolf also has an extensive hint system built into it. Hovering over an item, like the input
box in the Assign tool in this image; will show you how to use the item.
4 | P a g e
Warewolf User Guide 2 – Version 1.2
3. You can browse the Examples folder inside the Explorer directly, and open the example
workflows you need. The Examples folder also has several example apps and services that you
can explore and learn from.
4. Clicking the Help button on the toolbar will open the extensive Warewolf Knowledge Base
directly in your browser.
Warewolf Syntax
This section explains how we use and refer to data and variables in Warewolf.
There are two kinds of data in Warewolf:
1. Scalar variables: An individual piece of data: [[VariableName]]
2. Recordsets: Repeated data: [[Recordset(n).Field]] where n refers to the index of the recordset
Scalar Variables and Recordsets in the Variable Window
(Figure 2)
A Recordset may look something like this, where the Fields are Name, SecName and Surname. The
indexes are the row number: 1 or 2.
5 | P a g e
Warewolf User Guide 2 – Version 1.2
Name SecName Surname
1 Marjorie Ann Agnes Simpson
2 Bart Oscar Simpson
The Recordset data above can be given a collective name, such as People. This gives us the following: [[People().Name]] [[People().SecName]] [[People().Surname]]
Using Recordsets [[Recordset(1).Field]] :
As Input: Behaves exactly like a scalar variable: The value of Field in row/record 1 will be used.
So, from the table above [[People(1).Surname]] will be Simpson
As Output: Behaves exactly like a scalar variable. The value of Field in row/record 1 will be the
value of the result. If we were to assign the result of something (say Mike) to
[[People(2).SecName]] then [[People(2).SecName]] would now be Mike and not Oscar.
[[Recordset().Field]] : This recordset row has no index specified
As Input: Assumes the last index in a recordset. The value of Field at the last index, so you don't
have to track it. This works well for reading the last row in a recordset. [[People().Name]] will be
Bart.
As Output: Assumes a new Index. Appends a new record to the end of the recordset. If the
result we wanted to assign was Lisa, we could use the Assign tool: [[People().Name]] = Lisa. This
would create a new index (3) with a Name = Lisa and the remaining fields blank.
[[Recordset(*).Field]] : This will use every row in the Recordset (See Tools and Connectors for specifics
on each tool)
As Input: Will execute each and every index in the Recordset.
As Output: Will write a result to each and every index starting at 1, until there are no more
results.
[[Recordset()]] - no Field
As Input: Used in some tools to process specific recordsets.
As Output: Never.
6 | P a g e
Warewolf User Guide 2 – Version 1.2
Workflow Services
To move a Recordset from one workflow to another workflow simply map it in using * as the index, for
example [[People(*).Name]] will use every index of Name. In the Example below, we are mapping 2
records in the [[People()]] recordset to the [[Family()]] recordset.
(Figure 3)
Also, illustrated here is that by placing two variables next to each other in an assignment, they are
joined into one variable.
(Figure 4)
The Result
The new Recordset, called Family, will look like this, where the Fields are FName, SName and Town.
FName SName Town
1 Marjorie Ann Agnes Simpson Springfield, Oregon
2 Bart Oscar Simpson Springfield, Oregon
7 | P a g e
Warewolf User Guide 2 – Version 1.2
Services
Database, Web Service and Plugins endpoints are outside the control of Warewolf. If you enter a * we
will cram all the info into that input field. If you want to shape the data first, use the JSON or XML tool.
Calculations in Warewolf
(Figure 5)
As touched on earlier, when you type the = sign in a right assign text field the fx symbol appears. This
means that you have now entered math mode. Apart from standard mathematical functionality,
Warewolf also has a powerful formula system built into it that is functionally and syntactically
equivalent to Microsoft Excel.
There are 175 functions that cover the most commonly used calculations including: Compatibility, Date
and time, Engineering, Financial, Information, Math and trigonometry and Logical functions. This
functionality adds powerful mathematical capabilities to Warewolf.
Microsoft has a syntax reference online that you can use to find the right formula for the job. You
can find it here.
As an exercise, we are going to convert 6.5 pounds to kilograms. The syntax for the convert function is:
CONVERT(number, from_unit, to_unit).
The pound unit is “lbm”. The gram unit is “g” – remember to include the quotation marks.
8 | P a g e
Warewolf User Guide 2 – Version 1.2
1. Create a new workflow
2. Drag an Assign tool onto the design surface, and link it to the Start Node
3. Create a new variable called [[PoundValue]] and set its value to 6.5
4. Create another variable called [[Answer]] Assign the following to it: convert([[PoundValue]],
"lbm","g")
We want the answer in Kilograms so we need to divide the grams by 1000 to convert it into kilograms,
so the final formula will look like this:
= (convert([[PoundValue]], "lbm","g") )/1000
5. Click Done
(Figure 6)
Your Assign tool should look like the above. Press F6 to run your microservice in debug mode. The
answer will be assigned to the [[Answer]] variable.
Great work! Now we are going to turn this microservice into a conversion service. To do this we simply
need to do:
9 | P a g e
Warewolf User Guide 2 – Version 1.2
1) Clear the [[PoundValue]] variable, and the 6.5 value you assigned to it in the Assign tool on the
design surface
2) Flag [[PoundValue]] as an Input variable and [[Answer]] as an Output variable in the Variables
box.
3) To tidy it up a bit, let’s add KG to the end of [[Answer]]. To do this we add another variable in
the Assign tool [[Answer]] = [[Answer]] KG. The diagram below should be what your Assign tool
looks like now.
(Figure 7)
And that’s it. You now have a microservice that converts pounds to kilograms Click Debug from the
toolbar to try it out. Type a value into the PoundValue input field and click the View In Browser button
(in this example we used 10). Your browser output should look similar to this:
(Figure 8)
10 | P a g e
Warewolf User Guide 2 – Version 1.2
You can change the input value simply by changing the assigned value of PoundValue in the URL without
needing to press Debug each time. Let’s change it to 25 and press enter to run the microservice again.
(Figure 9)
Save your new microservice as PoundToKilogramConverter .
The Warewolf Connector Tools and Sources
Warewolf has three types of generic connectors: the Plugin tool, the Database tools and the Web
Service tools.
What these connector tools in Warewolf have in common is that they connect to a specific single item from
a Source. Some good examples of Sources are databases or websites. A single source can be used by
multiple connectors. For more information please look at the knowledge base article on Services and
Sources.
A database connector can connect to a specific stored procedure in a database, a plugin connector can
connect to a specific method in a DLL, and a web service connector can connect to a specific web service
on a website. To exploit a typical database, you would most likely have a single source to that database
and multiple tool instances that use that source execute a stored procedure.
Some of the tools also use a source, like the Email, Dropbox and SharePoint tools.
Sources identifier
In the Explorer, sources can be identified by a smaller secondary icon in the lower right corner of an
Explorer object. In this example, a Plugin source is identified by a small orange circle with a plus sign in
it.
11 | P a g e
Warewolf User Guide 2 – Version 1.2
The Web Service Tool
In this example we are going to use a Web Service tool to return data from a web service.
It is worth noting that there are Web Service connectors to use for GET, POST, PUT, DELETE, and TRACE
Request methods over HTTP or HTTPS. For this example we will use a standard GET over HTTP.
(Figure 10)
12 | P a g e
Warewolf User Guide 2 – Version 1.2
To start, create a new service by clicking the new service button in the toolbar.
Scroll down or search in the Tool Box until you find the HTTP Web Methods section. Drag the GET onto
the design surface and connect it to the Start node. It should look like this:
Click the New button at the top to create a new Source: A New Web Service Source tab should open.
In the Address bar type http://test-warewolf.cloudapp.net:3142/
Select Anonymous as Authentication Type. In the Default Query type in public/Hello World?Name= and
click the Test Connection button. It should look like this:
(Figure 11)
Click the Save button in the toolbar to save this new web service source-.
Save the web service as Test-Warewolf Web Service and navigate back to your new unsaved service.
Expand the GET tool by double clicking it in the blank part of its title bar.
Using the Source drop down list, find the Test-Warewolf Web Service you just created and select it.
You do not need to supply a Header. Note the URL and default Query String, Figure 12.
13 | P a g e
Warewolf User Guide 2 – Version 1.2
You can add the ability to pass a variable in by adding [[Name]] to the end of the query string. Do this
now. Your Query String should now be public/Hello World?Name=[[Name]]
(Figure 12)
One of the features in Warewolf is that you can add variables to most Text boxes, and Warewolf will
attempt to parse them at run time.
Now click on the Generate Outputs button and enter any data in the Test Data field, we’ll use Homer for
this example, Figure 13. Click Test. You should get an output that looks like this:
14 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 13)
Now, click Done.
Note the Name and DataListMessage variables in the Variables list which have automatically populated.
In the variables list, mark Name as Input and DataListMessage as Output.
15 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 14)
We are now ready to run this microservice. Click the Debug button in the toolbar. In the Name field
enter Homer, then click Debug.
(Figure 15)
16 | P a g e
Warewolf User Guide 2 – Version 1.2
You will see that the output in the Output panel uses the Name variable as an Input and the
DataListMessage as an output, as we intended in the Variables list.
(Figure 16)
Congratulations! You have just built a microservice that connects to an external Web Service using
Warewolf.
Save your new Microservice and call it GET Web Method Test.
17 | P a g e
Warewolf User Guide 2 – Version 1.2
The Database Source
In this exercise we are going to create and use a database connector. Database connectors in Warewolf
consume stored procedures and functions in your database server, so you can use them to either read
or update your database tables.
To do this exercise you will need to have access to a MS SQL Server. We use the standard
AdventureWorks database in this example.
I have created a simple stored procedure that fetches the players for a game. The SQL looks like this:
(Figure 17)
You will need to re-create this stored procedure in your AdventureWorks database to complete this
exercise. If this is not practical, and you do not have access to a SQL server, you can use a stored
procedure of your choice to complete the exercise. The main functionality this exercise will demonstrate
is to select data using a stored procedure, and use it in a Warewolf microservice.
We are going to use this stored procedure to return a list of players for a game.
To start, create a new service by clicking the new service button in the toolbar.
Scroll down in the Tool Box until you find the Database category. Drag the SQL Server tool onto the
design surface and connect it to the Start node. It should look like this:
18 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 18)
Click the New button to create a new database source.
On the New Database Source tab, for Type, select Microsoft SQL Server. Add your Server and select
Authentication Type as User, then add your User credentials. Now click Test Connection. Assuming this
is successful, you will be able to select your AdventureWorkds2008R2 database from the Database drop
down. Your New Database Source should look like this:
19 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 19)
Click the Save icon in the left hand menu and save your Source as AdventureWorks. Well done! You
have just created your first Database Source. You will find it in the Explorer.
(Figure 20)
Now navigate back to your service and open the SQL Server Database tool.
From the Source drop down list, select the AdventureWorks source.
After you have selected the source, the Action list becomes populated with all of the stored procedures
in your database. If you are working on the database at the same time, you can click the refresh button
to refresh the list.
It is important to note at this point, that the Warewolf server is actually making the connection to the
database server, so your Warewolf server must be able to access the SQL database server.
20 | P a g e
Warewolf User Guide 2 – Version 1.2
Back to the example: We are going to use the dbo.FetchPlayers stored procedure, so select it from the
Action list.
We now want to add a Variable as [[NumberOfPlayers]], as in the Figure D below. This allows us to pass
in the variable at run time.
(Figure 21)
Now it is time to FetchPlayers using the Generate Outputs button. Click this now.
In the GameNumber field, add the number of players you want to fetch. We will use 4. Then click Test.
You should see a list of 4 players in the Outputs section, Figure 22.
21 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 22)
Now click Done. You will notice the Recordset Name in the Variables list.
In the variable list, mark NumberOfPlayers as Input and dbo_FetchPlayers() as Output, Figure 23.
22 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 23)
Now let’s Debug this service. Add any number of Inputs in the Debug Window in the NumberOfPlayers
input box. We’ll use 4 again. Then click Debug.
(Figure 24)
23 | P a g e
Warewolf User Guide 2 – Version 1.2
If you look at the Output box, as in Figure 25, you will see the Inputs of NumberOfPlayers is 4, and the
Outputs are the same as the Outputs that you selected earlier in the Variables List.
(Figure 25)
You can also view this in your browser by using the shortcut key F7. Your browser will now display the
XML dataset that you have flagged as output variables as shown in Figure 26 below.
(Figure 26)
24 | P a g e
Warewolf User Guide 2 – Version 1.2
It’s time to save your microservice. Click the Save button on the toolbar, and name your new
microservice FetchPlayersService. Well done! You have just built your first microservice that returns
data from a database.
If you get stuck at any stage, remember you can always get help in the Community Forum.
The DotNet DLL Source
In this exercise we are going to use the DotNet DLL source to connect to a .Net Dynamic Link Library
(DLL).
The DotNet DLL Connector can be used to expose public methods in a DLL.
If you have some functionality in a DLL or need to build some functionality that Warewolf does not have
natively, a quick way to do this is to use a DLL.
To start, create a new service by clicking the new service button in the toolbar.
Scroll down in the Tool Box until you find the Resources category. Drag the DotNet DLL Connector tool
onto the design surface and connect it to the Start node. It should look like this:
25 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 27)
26 | P a g e
Warewolf User Guide 2 – Version 1.2
Click the New button to create a new connection to the plugin.
There are two primary options in the New Plugin Source window:
1. Selecting a DLL from the File System, or
2. Loading a DLL from the Global Assembly Cache (the GAC) . We are going to load a DLL from the
GAC. Do this by typing mscorlib and expand the GAC. You should be presented with the
registered DLLs like this:
(Figure 28)
Select an mscorlib entry, there may be more than one. Note the Assembly field at the bottom of the tab
may differ slightly:
(Figure 29)
Click Save from the left hand toolbar, and save your new plugin source as MSCORLIB. Navigate back to
your service and open the DotNet DLL Connector by double clicking the blank area at the top of the tool.
From the Source drop down select MSCORLIB. From the Namespace drop down select System.Random
– note that this may take a few moments to load all the namespaces from the source. Finally, in the
Action drop down select Next. There are no inputs, so your setup should look like this:
27 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 30)
Click the Generate Outputs button, then Test.
28 | P a g e
Warewolf User Guide 2 – Version 1.2
You will get Outputs similar to the following:
(Figure 31)
Now click Done. You will be taken back to the expanded view of the DotNet DLL Connector. Note the
PrimitiveReturnValue in the Mapped To field of the Outputs. You will also see the same variable in the
Variables List in Figure 32 and 33 respectively.
29 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 32)
(Figure 33)
It’s time to run this source. Click Done and then click the Debug button from the toolbar. In the debug
window, click Debug.
Remember you can always make use of the shortcut keys to debug. Press F6 to debug in the Studio or F7 to
view in your browser. A full list of the Warewolf shortcut keys can be found in our Knowledge Base.
You will see the output in the output window at the bottom right. It will look something like Figure 34. If
you press F6 it will debug again and show you a different value for PrimitiveReturnValue.
Congratulations! You have just created your first plugin microservice.
30 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 34)
The Server Dropdown List
The Server dropdown list appears in two locations in Warewolf, in the Explorer, and in the Publishing
Module (we will get to that in a little while). The Server dropdown list is a list of Server sources.
(Figure 35)
31 | P a g e
Warewolf User Guide 2 – Version 1.2
The Server dropdown list enables you to connect to different Warewolf servers and use them according
to your permissions and security settings on the server.
Let’s add a new Server source. In this Exercise, we are going to connect to the Warewolf Shared
Resource Server.
The Shared Resource Server is a repository of free resources contributed by the Community. Anyone
can contribute to the shared resources. Shared resources are provided as is with no warranty or liability.
You can browse and retrieve items from the Shared Resource Server.
Click the New Remote Server … list item in the dropdown in the Explorer. The New Server Source tab
will appear on the design surface illustrated in Figure 36.
(Figure 36)
Select http from the drop down then in the Address field, Type the store.warewolf.io into the Address
bar. By default Warewolf uses port 3142 for unencrypted traffic, and port 3143 for encrypted traffic.
You can change these ports in the file C:\Program Files (x86)\Warewolf\Server \Warewolf
Server.exe.config
We are going to connect on the public port. We are also going to use the Public authentication type, so
select Public.
32 | P a g e
Warewolf User Guide 2 – Version 1.2
Click the Test Connection button. The test should be successful. The Save button in the toolbar will
become enabled.
(Figure 37)
Save the connection as Warewolf Store. We will use this connection a little later on.
(Figure 38)
33 | P a g e
Warewolf User Guide 2 – Version 1.2
To Locate your new Server Source (Warewolf Store) and start using the resources:
1. Select your source from the Dropdown List, in this case it will be the Warewolf Store.
(Figure 39)
2. Once you have selected the Warewolf Store click on the Connect Icon as indicated below.
(Figure 40)
34 | P a g e
Warewolf User Guide 2 – Version 1.2
3. A list of the Warewolf Store Resources available will appear in the Explorer.
(Figure 41)
Security
Warewolf has a strong, granular security model that runs on top of Windows Active Directory. All
security is based on AD user groups instead of user accounts. Using groups is an efficient way to handle
security. Users are added to groups that are defined by the user roles. There are two main security
layers in Warewolf. The first is Server Permissions, which includes server specific functions, like
Administration and Deployment. The second is a highly granular Resource based layer that enables an
administrator to assign groups to specific resources.
35 | P a g e
Warewolf User Guide 2 – Version 1.2
There are three important concepts to remember with permissions and how they are allocated by
Warewolf:
1. Resource Permissions over-ride Server Permissions
2. Permissions are cumulative in nature
3. Anyone accessing the server can get Public permissions if set in the URL, so be very careful with
how you define your Public Server Permissions.
(Figure 42)
36 | P a g e
Warewolf User Guide 2 – Version 1.2
Server Permissions for a Group
Server permissions are a broad scoped default mechanism for providing security permissions for the
server based on user groups. These include all of the options in the Security Permissions section below –
per group. For example a group could just have Execute rights. This would mean that this group would
not be allowed to edit or view the microservice in the designer.
Resource Permissions
Resource permissions are defined per resource. Resource permissions allow fine-grained control of
system usage and access
As a member of “Data Capture” and “Data Retriever” groups, a user would have all the permissions of
“Data Capture” PLUS all the permissions of “Data Retriever”. So if “Data Retriever could only execute
Service A and “Data Capture” could only view Service A, then the user, as a member of both groups,
would be able to View and Execute Service A.
Security Permissions
Deploy To – By default this group can deploy resources onto this server Deploying may mean
overwriting existing work and can be done without Contribute privileges
Deploy From – By default this group will be able to deploy resources off this server
Administer – Administrators can amend security and change server settings. The local machine
Administrators are automatically given this permission. Giving public access to this permission is the
same as turning security off, and this is not recommended at all.
View – This group can open and view resources on the server. This is typically used by business analysts
to sign off work and participate in the development process.
Execute – This group will be able to call or execute resources in this server.
Contribute – This group will be able to add new resources, Edit resources and delete existing resources
on this server. This group can also view and execute resources.
37 | P a g e
Warewolf User Guide 2 – Version 1.2
Security Settings on Servers
If you have administrative permissions on the server you have connected to, you will be able to edit the
settings, including the User and Logging settings.
Exercise
(Figure 43)
Click on the Settings button and open the security tab. In the Resource Permissions as illustrated in
Figure 43. Click the … button in the Resources column. Select the Hello World microservice. In the
Windows Group, click the … button. Select the All Users Group. Check View and Check Execute. Click
the Save button to save your changes.
When you log into a Warewolf Server, the Explorer will set up your resource permissions and next to each
item in the explorer.
Figure 42 illustrates the permissions indicators and what they mean. These permissions reflect the
security configuration that has been set up for the Warewolf Server whose Resources you are accessing
(Figure 44)
38 | P a g e
Warewolf User Guide 2 – Version 1.2
Logging
Warewolf has 7 levels of logging available ranging from None to Trace Logging See Figure 45. Logging
happens for both the Server and the Studio. The lower the logging level, the better the performance.
Trace logging is fairly demanding on a server, but it is required on occasion. If you have to use Debug or
Trace logging, remember to dial it down after you have finished finding the error.
You can set the size of the log file. By default the log files are set to 200 Megabytes, but you can change
them to any size you want. Remember to Click the Save button if you make any changes to the settings.
Both the Server and Studio sections have links that open the log files. The text is orange.
(Figure 45)
39 | P a g e
Warewolf User Guide 2 – Version 1.2
Exercise
Open the Server Log file, by clicking on the Server Log File link. (The log file will open in your default text
editor).
Warewolf appends to the log files, so the latest log entries will be at the bottom of the file. The log entry
always starts with a date-time stamp to identify what time the event was logged.
Scroll to the bottom of the file to see the latest entries. When you are finished, simply close the log file.
Please be aware, that the file needs to transfer to your local Warewolf Studio before you can open it. If the
file size is large, the file will have to download from the server before you will be able to view it.
Warewolf logs all errors. If you need technical support for an error, your log file will prove very helpful in
locating it.
Creating a Task / Scheduling
Warewolf uses the underlying Windows scheduler to handle scheduled events in Warewolf. You can run
scheduled microservices as jobs using the Scheduler. You can use the Scheduler to run once off or
recurring jobs, like data imports, or social media publishing. The Scheduler runs on the Windows server.
Click on the Task button on the toolbar to schedule a service to run. The Scheduler window will display
in the work surface area.
For this exercise we will schedule the Hello World microservice to run at 6 am during weekdays.
Click the Schedule a new task button. In the right pane, at the top, click the edit button adjacent to the
Triggered at field.
Set your trigger up according to the Illustration in Figure 45.
This trigger is set to start running on selected date at 6am – In your case it will be todays date unless you
changed it. The trigger will run weekly, on weekdays, and it will recur every 1 week, which means that it
will run every week.
When you are done, click the OK button.
40 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 46)
Name the Task Hello World. Set the Status to Enabled.
Next to the Workflow textbox, click the … button to open up the Select a Service Popup Window
41 | P a g e
Warewolf User Guide 2 – Version 1.2
(Figure 47)
Select the Hello World microservice and click the OK button.
You can check the Run task as soon as possible after a scheduled start is missed option to run the Hello
World microservice at the next interval after you save the microservice.
Your Scheduler window should now closely resemble Figure 48. Click the Save button on the toolbar to
save your scheduled task, when you are satisfied that yours is the same.
(Figure 48)
That’s really how easy it is to set up scheduled tasks using Warewolf.
42 | P a g e
Warewolf User Guide 2 – Version 1.2
Deploying Warewolf has a full publishing platform built into it that enables you to publish resources between
Warewolf Servers. Publishing is the only way you can move resources between servers.
Warewolf servers encrypt resources based on the server’s unique identifiers, so it is not possible to simply
move resources between servers.
Let’s publish a resource from the Warewolf Store (http://store.warewolf.io:3142) to our local Warewolf
server. Click the Deploy button on the Toolbar to move resources between Warewolf servers. The
Deploy window will display in the work-surface area. The idea with deploy, is that you can deploy
between 2 servers. On the left is the Source Server panel and on the right is the Destination Server
panel.
(Figure 49)
From the Source Server dropdown list, select the Warewolf Store Source that we set up earlier. As you
are not actually connected to the Warewolf Store at this point, click the Connect button next to the
dropdown list to connect to the server. This will take several seconds to make the initial connection, give
it a moment to populate.
43 | P a g e
Warewolf User Guide 2 – Version 1.2
From the Destination Server dropdown list, select the localhost Source, which is your local Warewolf
server.
You’ve probably realized at this point that using Deploy, you can deploy resources between any two
Warewolf Servers that you have permission to deploy from and to.
From the Warewolf Store, check the Backup Example.
In the information pane to the right of Explorer, is the Select All Dependencies button. It is advisable to
always click this button. Warewolf microservices often have dependencies, like sources, connectors, and
embedded microservices. When you choose this option, the Deploy manager will ensure that all of the
resources you need to deploy in order to make the Resource you want to publish to work will be
deployed along with it.
When the dependencies have been selected, the Deploy button will become active. Click the Deploy
button to deploy the selected resources and its dependencies from the Warewolf Store to your
Localhost.
After you have completed the deployment you will see that the newly deployed resources are now
available for you to use, and accessible in the Server Resource Explorer.
It’s really that simple to deploy resources between Warewolf Servers. This effectively means you can
manage multiple Warewolf servers from a single location using Warewolf Studio.
Service Discovery in Warewolf Every service that is created in Warewolf is automatically available for discovery using Warewolf’s built
in APIs.json and Swagger discovery service. What you see in the discovery service depends on what your
security permissions are. If a service is locked down to a specific AD user group that you are not a
member of, you will not see the service in the APIs.json.
APIs.json Let’s have a look at the APIs.json for your server. Open your web browser and navigate to the following
URL : http://localhost:3142/apis.json Running this will produce a file similar to the following (depending
on the services on your server and the security setup):
{ "Name": "Dice Roll_test", "Description": null, "Image": null, "humanUrl": null, "baseUrl": "localhost:3142/secure/Examples/Dice Roll Example/Tests/Dice Roll_test.json", "Version": null, "Tags": null,
44 | P a g e
Warewolf User Guide 2 – Version 1.2
"properties": [ { "type": "Swagger", "value": "localhost:3142/secure/Examples/Dice Roll Example/Tests/Dice Roll_test.api" } ], "contact": null }, { "Name": "Double Roll and Check_test", "Description": null, "Image": null, "humanUrl": null, "baseUrl": "localhost:3142/secure/Examples/Dice Roll Example/Tests/Double Roll and Check_test.json", "Version": null, "Tags": null, "properties": [ { "type": "Swagger", "value": "localhost:3142/secure/Examples/Dice Roll Example/Tests/Double Roll and Check_test.api" } ], "contact": null }, { "Name": "Hello World", "Description": null, "Image": null, "humanUrl": null, "baseUrl": "localhost:3142/secure/Hello World.json", "Version": null, "Tags": null, "properties": [ { "type": "Swagger", "value": "localhost:3142/secure/Hello World.api" } ], "contact": null }, { "Name": "Hello World", "Description": null, "Image": null, "humanUrl": null, "baseUrl": "localhost:3142/public/Hello World.json", "Version": null, "Tags": null, "properties": [ { "type": "Swagger", "value": "localhost:3142/public/Hello World.api" } ], "contact": null }
45 | P a g e
Warewolf User Guide 2 – Version 1.2
Above is a snippet of some of the services available on a Warewolf Server.
Warewolf shows you the services based on security setup of the server; this can be seen by the fact that
there are two entries for the Hello World service in the definition above.
One of the entries has “secure” in the base URL and the Swagger entry, the other has “public”. What this
denotes is that my Hello World service is available as a secure service and it can be accessed
anonymously as a publically available service.
Swagger The snippet above contains a properties section which includes a property for “Swagger” and it has a value that follows the format {SERVERNAME}:{PORT}/{DIRECTORY}/{SERVICE}.api.
In the example of the Hello World service above, to get to the Swagger definition, navigate to the following URL to see the Swagger definition for the Hello World microservice http://localhost:3142/secure/Hello%20World.api
Navigating to this URL displays:
{ "swagger": 2, "info": { "title": "Hello World", "description": "", "version": "1.0.0" }, "host": "localhost:3142/", "basePath": "/", "schemes": [ "http", "https" ], "produces": "application/json", "paths": { "serviceName": "Hello World", "get": { "summary": "", "description": "", "parameters": [ { "name": "Name", "in": "query", "required": true, "type": "string" } ]
46 | P a g e
Warewolf User Guide 2 – Version 1.2
} }, "responses": { "200": { "schema": { "$ref": "#/definition/Output" } } }, "definitions": { "Output": { "type": "object", "properties": { "Message": { "type": "string" } } } } }
The Swagger definition can be used to consume Swagger, and systems can use the Swagger definition
to automatically consume Warewolf services.
47 | P a g e
Warewolf User Guide 2 – Version 1.2
Resources
Download Warewolf : https://warewolf.io
Get license for Support: https://warewolf.io/pricing.php
Warewolf Knowledge Base: http://warewolf.io/knowledge-base/
Community Forum: http://community.warewolf.io/
Warewolf Source Code on GitHub: https://github.com/Warewolf-/Warewolf-
The Warewolf Blog: http://warewolf.io/-blog/
Like Warewolf on Facebook: https://www.facebook.com/Warewolf.io/?ref=ts&fref=ts
Follow Warewolf on Twitter: https://twitter.com/Warewolf_io
Tutorial videos: http://warewolf.io/knowledge-base/categories/video-tutorials/
Warewolf Shared Resources server: http://store.warewolf.io/3142 (Connect with Warewolf Studio)