Macros | Functions
zoo_loader.c File Reference
#include "fcgio.h"
#include "fcgi_config.h"
#include "fcgi_stdio.h"
#include <sys/types.h>
#include <unistd.h>
#include "service_internal.h"
#include "response_print.h"
#include "cgic.h"
#include <libxml/tree.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include "request_parser.h"


#define MALLOC_CHECK_   0
#define MALLOC_CHECK   0
#define TRUE   1
#define FALSE   -1


int runRequest (map **)
 Specific includes. More...
int cgiMain ()
 Main entry point for cgic. More...

Macro Definition Documentation

#define FALSE   -1
#define MALLOC_CHECK   0
#define MALLOC_CHECK_   0
#define TRUE   1

Function Documentation

int cgiMain ( )

Main entry point for cgic.

0 on sucess.

We'll use cgiOut as the default output (stdout) to produce plain text response.

In case that the POST method was used, then check if params came in XML format else try to use the attribute "request" which should be the only one.

Store the original XML request in xrequest map

int runRequest ( map **  inputs)

Specific includes.

Specific includes.

inputsthe request parameters map
0 on sucess, other value on failure
See also

Parsing service specfic configuration file

Manage our own error log file (usefull to separate standard apache debug messages from the ZOO-Kernel ones but also for IIS users to avoid wrong headers messages returned by the CGI due to wrong redirection of stderr)

Here we need to close stdout to ensure that unsupported chars has been found in the zcfg and then printed on stdout

Loop over Identifier list

Create the input and output maps data structure

05-007r7 WPS 1.0.0 page 57 : 'If status="true" and storeExecuteResponse is "false" then the service shall raise an exception.'

Initialize the specific [lenv] section which contains runtime variables:

  • usid : it is an universally unique identifier
  • osid : it is an idenfitication number
  • sid : it is the process idenfitication number (OS)
  • uusid : it is an universally unique identifier
  • status : value between 0 and 100 to express the completude of the operations of the running service
  • message : is a string where you can store error messages, in case service is failing, or o provide details on the ongoing operation.
  • cwd : the current working directory or servicePath if defined
  • soap : is a boolean value, true if the request was contained in a SOAP Envelop
  • sessid : string storing the session identifier (only when cookie is used)
  • cgiSid : only defined on Window platforms (for being able to identify the created process)

dady : set status to SERVICE_ACCEPTED

son : have to close the stdout, stdin and stderr to let the parent process answer to http client.

set status to SERVICE_STARTED and flush stdout to ensure full content was outputed (the file used to store the ResponseDocument). The rewind stdout to restart writing from the bgining of the file, this way the data will be updated at the end of the process run.

error server don't accept the process need to output a valid error response here !!!

Ensure that if error occurs when freeing memory, no signal will return an ExceptionReport document as the result was already returned to the client.