Build HTTP Services in DataFlex
Lesson 6 - Manual IIS Configuration and Conclusion
This lesson will show things that happen behind the scenes, and some advanced techniques that can be done with the HTTP Handler. The HTTP Handler works by hooking into the Internet Information Service (IIS) via a .dll that is part of DataFlex as a “native” HTTP module. It registers itself in IIS and IIS will call it whenever a request comes in that the HTTP Handler is activated for. The HTTP Handler reads the configuration from the IIS configuration scheme. This extends IIS configuration system with the settings needed for the HTTP Handler. These settings are written in the web.config file inside the AppHtml folder.
This is how the HTTP Handler knows which DataFlex application and object it should access. The config file is written when an application is compiled in the Studio. There are items registered globally in IIS during installation to make all this work. The following demonstration will show the settings and how they can be altered.
- There is a section of the help that explains how to do the installation manually that covers the steps to install IIS, and how to configure IIS for working with DataFlex.
- There are two steps to it:
- add-wso-restriction: needed for webservices to run
- register-http-module: reduces the HTTP module inside IIS
- It registers the DLLs and writes a piece of XML to the IIS configuration file
- In the IIS manager, the HTTP Handler is registered globally, which can be seen in the ‘Modules’ section.
- The ‘Configure Native Modules…’ link in the right menu of this section opens a window that shows both a 32-bit and 64-bit version. IIS will choose which one to use based on the settings in the application pool.
- It is not enabled at a global level, but only for DataFlex applications. The \WasHttpMod.dll files that are shown are the actual implementation of the HTTP Handler in C-code. These are located in Bin64 in the DataFlex folder.
- Inside the AppHTML folder there is a web.config file. This file contains the configuration of the HTTP modules. It lists all the handlers that are waiting in the web application. The Studio generates this file when compiling.
- The XML shows that the DataFlex HTTP module contains an application name, the web object name, and the location path, and then it is enabled. The error type and verbs are read from the source code and generated here by the Studio, so changing them at runtime will not work. This file can be edited, but any changes will be removed upon recompilation. That can be prevented by using the manual=”true” option on the DataFlex HTTP module element the Studio will leave this element alone.
- Copying one of the modules, changing it’s URL, and setting both this new module and the original to manual=”true” will allow the file to be pulled from either location.