2.3 The Web Service Tool

In this video we show you how to connect to external web services using the Web Service Tool in Warewolf. We use the GET web service connector to request methods over HTTP.

The Web Service tool is one of three types of generic connectors inside Warewolf.

What these connector tools in Warewolf have in common is that they connect to a specific single item from a Source like a database or website. A single source can be used by multiple connectors.

The web service connector can connect to a specific web service on a website.

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.

Plugin Source Icon in Warewolf

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.

  1.  To start, create a new service by clicking the new service button in the toolbar.
  2.  Scroll down or search in the Tool Box until you find the HTTP Web Methods section.
  3. Drag the GET onto the design surface and connect it to the Start node.
  4. 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 https://store.warewolf.io:3143/
  5. Select Anonymous as Authentication Type. In the Default Query type in public/Hello World?Name=   and click the Test Connection button.
  6. Click the Save button in the toolbar to save this new web service source.
  7. 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.
  8. 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.
  9. 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]]. 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.
  10. Now click on the Generate Outputs button and enter any data in the Test Data field, we’ll use Homer for this example Click Test.
  11. Now, click Done. (Note the Name and DataListMessage variables in the Variables list which have automatically populated.)
  12. In the variables list, mark Name as Input and DataListMessage as Output.
  13. We are now ready to run this microservice. Click the Debug button in the toolbar. In the Name field enter Homer, then click Debug. 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.

We’ve just built a microservice that connects to an external Web Service using Warewolf, it’s that easy!

Let’s save our new Microservice and call it GET Web Method Test.

 

FacebookTwitterLinkedInGoogle+Email
Updated on June 22, 2018

Was this article helpful?

Related Articles

Enjoying Warewolf?

Write a review on G2 Crowd
Stars