__header__
The Web Server tools are a set of three tools, HTTP Protocol, Extension Collection, and Domain Collection, that will collectively work to support a web page/site as its web server. The three tools work together to create the functions of the website as well as to communicate with the world wide web to allow anyone to view and use the website connected with it.
This service/program is still within the prototype stage, but the
following information will explain how it will work when it is
finished.
ScriptService (WKS tags in HTML Script)
A new DLL (webservices.dll) has been created to handle different types of web services (http://en.wikipedia.org/wiki/Web_Service) offered by the Automation Manager software. The web services dll currently has two objects:
Other useful protocols that might be of benefit to support as web services are REST (http://en.wikipedia.org/wiki/REST ) and SOAP (http://en.wikipedia.org/wiki/SOAP ).
New InterfacestService object is a ROTAddin and must be added to the ROT of a workspace that has the HTTP protocol running. If no file handler is found by the HTTP Protocol Object the ROT is searched for instances of IWebService. The web services is asked if it can handle the current user request and if so is then replicated and given the request to handle.
The ScriptService internally determines whether it can handle a request by examining the Service Location and Script Types Handled parameters.
Service Location is a URI that represents the web service’s endpoint. i.e. for a REST service the entry might be http://www.automationmanager.com/services/rest/
Script Types Handled is a string that gives the file extensions that must be parsed by the web service. i.e. for ScriptService the entry might be .syn,.spx
If the Enabled parameter is not checked then the web service is disabled and will not process requests.
Once the HTTP protocol has determined that the ScriptService can handle a user request it query for IFileMapperCGI interface and sets the environment variables and POST variables if present. The ScriptService stores all environment variable in parameters starting with ENV_. Users cannot set or overwrite ENV_ variables. POST variables are stored as ENV_POST_ and PARAM_ parameters. GET variables are stored as ENV_GET_ and PARAM_ parameters. The current user request is sent and loaded through IFileArchive interface. The ScriptService loads the given file and parses the data. Anything outside of tags is treated as output text and put into the output stream. This means that normal HTML can be placed anywhere in the file as long as it is not between the tags. The ScriptService parses text between the tags and outputs data dependant on the script between the tags.
The script between the tags is broken down into statements by the use of ‘;’ to denote the end of a statement. A statement consists of keywords, Automation Manager Protocol commands, operators and literal values.
The keywords that can be used are as follows:
The IVariant object is used to determine the type of variable being operated on and what comparison is valid. Currently integers and doubles are compared as doubles, strings and numbers cannot be compared and objects are not compared at all.
Literal Values: String are represented by double quotations e.g. “literal string” Numbers are represented by the literal number e.g. 45.67, 33.
Automation Manager Protocols:
If a command in a statement cannot be handled by the ScriptService then the ROT is searched for a WebServiceProxy object or a ProtocolManager object, that can handle the request, and is passed off. Any resulting output from the handler is returned and handled as determined by the script.
The commands passed into the ProtocolManager can contain script variables. A script variable in a protocol command is set by wrapping the script variable between {}. This enabled the ScriptService to replace the variable with the actual value before sending the request to the Protocol Manager.
NOTE: If a ProtocolManager other than HTTP Protocol is added to the ROT make sure that it is below the HTTP Protocol otherwise your web server will not work. The ProtocolManager interface has been edited to include a CanHandleRequest function allowing the ScriptService to check if the ProtocolManager can handle a request without having to initiate a process of the request.
To test IE
http://localhost:88/index.syn