“Go confidently in the direction of your dreams. Live the life you have imagined.” – Henry David Thoreau
I was raised fifteen miles west of Concord, Massachusetts. More specifically, I was raised 14.9 miles west of Walden Pond and the short-lived home of Henry David Thoreau (HDT). Working with ServiceNow and using the acronym “SNow” has had me reminiscing of times past. I reside in Florida now, and it has been many years since I’ve seen or touched real snow. It has also been many years since I shadowed the walls of Thoreau’s small cabin beside the lake; more of that another time.
The following work was completed using Stat 5.8.0 and ServiceNow version Fuji. The code to be included will work with Stat 5.7.x and above. The code has only been tested on ServiceNow Fuji. ServiceNow Geneva and other releases have not been tested. Before you begin making changes to your system, you should be able to comfortably answer the following questions:
- SNow: The MID Server: What is it and do I need one?
- Stat: What documentation exists for Stat Web Services (WS) and is there any sample code available?
- Stat: Can I make Web Services work locally first? “I learned this, at least, by my experiment …” – HDT
- General: Java and Visual Basic. Can I at least read Java code? If not, can I read and write ASP.NET/VB.NET? (If yes, then email me at the address in this blog, and I will send you the same sample code in ASP.NET/VB.NET.)
A MID-Servers Night Dream
There I go again — mixing up my authors. I meant that a MID Server can be a dream, but why?
Since I do not have a local installation of SNow, I must utilize a MID Server to allow access to and to facilitate communication between my local system and my remote SNow environment. This is key in getting things to work! I run Stat on a VMWare 12.x Workstation image off of my laptop, which is behind my Verizon FIOS home router, with normal settings used for such common purpose.
Within SNow, filter down to “MID Server.” (If you don’t know how to setup the MID Server, take a look at these instructions.) If you have not setup a MID Server and need to, do so now according to the installation instructions on the Wiki you filtered to.
Once your MID Server is installed locally and running as a service on Windows, you are in good shape to continue. Nothing will work if this is a needful yet undone task.
“This world is but a canvas to our imagination.” — HDT
Stat: WS Calls Available?
Regardless of the version of Stat you are running (provided it is at least version 5.6.x), the documentation and sample code included remain the same. Look to the Stat installation media, whether you received the CD or you downloaded the release from Support. Within the media, there will be a folder named “web_services_sample.”
Finding this folder and understanding its contents will allow you to “… live with the license of a higher order of beings …” (HDT)
Take a look at the PDF document Stat_5.6.1_Web_Services.pdf in the folder. Also in the folder will be a Zip file named “StatWS.zip.” Extract the files, and there will be a Word document called “Web Services Sample Code.doc,” which will show you the Java code that is included with the Zip file and how to call it. Take time to read and understand the files in this Zip file, including the StatWS.java file, the bat files for Windows and shell files for Linux. You should be able to successfully execute the following files found within the Zip file:
What do you see?
“It's not what you look at that matters, it's what you see.” — HDT
The following screen shot displays the running of the three main Stat WS base calls: Env.bat, Generate.bat and run.bat.
“Things do not change; we change.” — HDT
“If you have built castles in the air, your work need not be lost; that is where they should be. Now put the foundations under them." — HDT
In the next part of the series, we will dig into the above code, set up connections to SNow and run some sample calls.
The Henry David Thoreau cabin on Walden Pond, Concord, Massachusetts, built 1845.
Thank you for taking the time to read this blog, and I hope you have found it informative to this point.