Web Service POST Call Output
Last Updated on by
To follow along with this guide, please download the following files: OutputGuide
This guide will demonstrate how to output a eFORMz project using a web service call by two different forms. ProjectB.efz calls eFORMz using a configuration file stored on the eFORMz Web Server. A single URL parameter of “config” with a relative file location of the configuration file is used. The data is POSTed as an XML file.
ProjectC.efz calls eFORMz for “output” using a ServiceConfiguration wrapper. The URL has no additional parameters. The XML data is wrapped in an <InputData> element within a <ServiceConfguration> root. The root contains the processing details. Parameters for a web service call may be found in this document: http://support.minisoft.com/index.php/eformz-api-url-parameters/
What is the output parameter used for in a web service call? It is to output data from an eFORMz project immediately. In this guide we will create a .XML file output that is accessible from a web service call in the ProjectB.efz file.
This is purely an example and eFORMz would not be used this way in a production environment. eFORMz can use a Rule “Output from Project” that doesn’t use a web service call to receive the output from another project in eFORMz.
This is to show how applications can use the functionality of a web service call to eFORMz’s web service API. Any application that can call a web service will have to use the following URLs in this guide.
Here is a reference to the guide.
eFORMz API URL Parameters
Output a eFORMz project using a web service call
Here we have the variables for the project. The Filename variable is used to determine where to place the output file.
1. Set value to variable “Full Data File Name”. “Full Data File Name” is the full file path from where the eFORMz project input data is located and “Data File Name” is the name of the file after the full file path. If you had an input data file called “ExampleXML.xml” the “Full Data File Name” would be the path…\ExampleXML.xml and “Data File Name” would be ExampleXML.xml.
2. We will replace the Data File Name with variable Current Time (Timestamp). Current Time (Timestamp) returns the current time as the number of milliseconds since. An example of ProjectB’s filename path could be “1514917018286.xml”
The variable URL is used for the web service URL that is accepted by eFORMz:
3. Set the value to the desired URL.
4. Variable XMLData is the “RequestData”. This variable needs to have some sort of input data to be able to send the web service call. We are using Load from File, but you can also use Set value to send XML data as well.
5. The variable Response data is a variable that uses the Write To File function to write in the output data from the eFORMz project that the web service is calling, MIME Output Data from the web service call to the variable Filename.
6. The variable response Code is used to display the web service call status codes. 500 is an error and 200 is successful.
The Post-condition procedure is used to start the Web Service call action.
8. Create the web service action.
9. The Web Service Procedure uses the RequestData variable. Create an action inside of the Web Service.
10. Right click on the web service call action and open the properties window.
11. 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 URL. 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.
12. Set the variable ResponseCode. This will return error codes from the Web Service to better monitor if the service was successful.
13. Display Forms and Data will refresh the eFORMz project, which will create another Web Service call.
14. The ResponseCode will be set to 200 and the ResponseData will have the output information from the eFORMz project you are calling if it was successfully. The XML file has been created.
15. The eFORMz project that you are calling must be returning data. In this example we can see that MapPackSlipData() is being used to return XML data.
For more details on the eFORMz API, consult the following posts:
eFORMz API (Called as a Web Service)
eFORMz API .NET Web Service Call
eFORMz API URL Parameters
Web Service POST call to “Wake Up” a “Sleeping” Queue: Part 1
Web Service POST call to “Wake Up” a “Sleeping” Queue: Part 2
Web Service POST call to “Wake Up” a “Sleeping” Queue: Part 3