Web Service POST call to “Wake Up” a “Sleeping” Queue: Part 3
To follow along with this guide please download the following zip, which contains WakeUpDirectoryQueue.efz and ws_accessible.cfg.
WakeUpQueueGuide (Project files).
The web service URL that we will be using is going to be set to the following:
http://localhost:8001/servlet/com.minisoft.AppServer.AppServer?APP=com.minisoft.eformz.eFORMzApp&director&Host=localhost&Port=9996&User=minisoft&Password=password&ConfigurationName=ws_accessible.cfg&QueueName=Test&NameTemplate=data.xml&ProcessData=true
Here is the URL broken up into sections:
- http://localhost:8001/servlet/com.minisoft.AppServer.AppServer?APP=com.minisoft.eformz.eFORMzApp (Base URL)
- &director&Host=localhost (Will be using the director on a localhost)
- &Port=9996
- &User=minisoft
- &Password=password
- &ConfigurationName=ws_accessible.cfg
- &QueueName=Test
- &NameTemplate=data.xml (the file extension of the data you are passing through the web call)
- &ProcessData=true (web service will wake up the queue monitor (if it is sleeping) to process immediately)
1. Create this URL by creating a variable and setting the value to that url. Here is an example with the variable “WSURL”. The URL is being set into the variable by the function Set to Value, which is a right click on the variable and select function “Set Value”. You can also use the function “Concatenate”, which appends that certain line to the URL, to have a better understand of what is being placed into the URL.
2. Once the URL is set you will want to create variables for “Request Data”, “ResponseData”, and “ResponseCode”.
- Request data – Data that is going to be sent via web service call. We currently have XML data.
- ResponseData – MIME Output Data from the web service call.
- ResponseCode – Error codes from the web service call. 500 is an error and 200 is a successfully.
3. Create the webservice action.
4. The WebService Procedure uses the RequestData variable. Create an action inside of the WebService
5. Right click on the web service call action and open the properties window.
6. Select the Request verb POST. Select this action to use the variable that was assigned the Web Service call URL. In our example it is WSURL. Set the input data and output data to MIME. In our example we are passing through XML, so the content type is set to XML. The MIME Output Data is set to the variable ResponseData.
7. Set the variable ResponseCode. This will return error codes from the Web Service to better monitor if the service was successful.
8. For testing purposes, add a variable (Timestamp) to check if the Web Service is being sent.
9. Display Forms and Data will refresh the eFORMz forms and Data, which will create another Web Service call.
The ResponseCode will be set to 200. The data will have been set to the name of your queue in our example it is sent to “Input/test”. The data should instantly be sent to “output/test” even though the queue is sleeping for 500 seconds. The sleeping queue has been awakened using a Web Service call