eFORMz API (Called as a Web Service)
Calling a Web Service vs. Calling eFORMz as a Web Service
The majority of times web services are used with eFORMz, the eFORMz project calls a remote web service. There is extensive documentation about this process at the following page:
That said, eFORMz can also be called as a web service. We loosely refer to eFORMz calling itself as the eFORMz API (Application Programming Interface). For example, eFORMz can call a web service to post data to a queue, as described in the following post:
Sample of eFORMz being called as a Web Service
Below, you can find working examples of calling eFORMz as a web service. Various utilities and applications can be used to access eFORMz as a web service. These include SQL Server, VB.Net, curl (a Linux utility), ABAP (scripting language in SAP), and many more. While working samples of these various languages and utilities are available, the samples below are in eFORMz format, via eFORMz projects (.efz) and actions within those projects. Together, the following projects parse and pass XML files with embedded ZPL and return a PDF file.
|ProjectA.efz||This project is used to format XML data to an output format. Essentially it’s the source of the PDF file.|
|ProjectB.efz||This project 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||This project 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.|
|ProjectE.efz||This project calls eFORMz for “director” using a ServiceConfiguration wrapper, similar to ProjectC. In place of a PDF return, the XML data is passed to a background instance of eFORMz Director for processing asynchronously.|
Type “output” = Process synchronously, return when the current project is complete with a file in the format requested.
Type “director” = Process asynchronously, return immediately with the data passed on for processing in another thread. The other thread can be configured to start when the data arrives or at a configurable time interval.
The default ports used by eFORMz as a Web Server are 8000 and 8001. These are the secure (https) and unsecure (http) ports respectively. There are configurable options for the ports used and to redirect unsecure requests to the secure port. When calling the eFORMz web server from the local system (where hostname would be localhost), the hostname, port, username and password are not required.