SRF file

Let's look at an SRF file for a SOAP web service.

{{ Handler * }}{{//}}
{{ RunPath(bin,../common) }}{{//}}
{{ StartService(tutorial2 -v) }}{{//}}
{{ XMLExchange }}

First, let's understand the rather curious looking tag, {{//}}. This tag has the job of consuming whitespace (that is, preventing the {{//}} tag and any surrounding whitespace from being rendered back into the response payload). Whitespace includes spaces, tabs, form feeds and the like, between the other tags. The use of this tag allows us to write an SRF file that presents each tag on a separate line even though the rules of SOAP responses preclude the inclusion of such whitespace to make the response more human-readable.

The {{Handler}} tag is basically a signature tag that must appear within the first few hundred characters of the SRF file. It is replaced with a zero-length string in the response and is used internally by the HTTP server and request handler.

The {{RunPath}} tag is used to set environment variables for the service program so that the service program can find its object and data files. This is similar to shell script commands that are used to set these environment variables in the normal runtime environment. The {{RunPath}} tag is replaced by a zero-length string in the response.

The {{StartService}} tag is used to request that a service program be started by the service engine. (Note that in stateful applications, the StartService tag is used to determine whether the correct service program is running in the saved state of the session. See the reference documentation for more information.) The {{RunPath}} tag is replaced by a zero-length string in the response.

Finally, the {{XMLExchange}} tag functions as the synchronization point between the request handler and the service program. The request handler suspends processing the request until signaled by the service program.