Globus Service Engine

The Globus Service Engine API implements hosting of C-language web services. More...

Functions


Detailed Description

The Globus Service Engine API implements hosting of C-language web services.

The engine uses the HTTP protocol implementation in globus_xio to process service connections from web service clients. The API provides functions to start and stop serving web service requests, as well as functions to more finely control the management of service connections.

This API should be used for applications which want to provide a service interface to their functionality, or which to host services (such as the Notification Consumer service). The globus-wsc-container program is an executable which wraps the basic functionality of this API.


Function Documentation

void globus_service_engine_destroy ( globus_service_engine_t  engine  ) 

Destroy a service engine

Destroys a stopped service engine, releasing all resources associated with it.

Parameters:
engine Engine to destroy. After this call is complete, the engine reference is invalid.
Returns:
void

globus_result_t globus_service_engine_get_contact ( const globus_service_engine_t  engine,
char **  contact 
)

Get contact information for a given service engine

Returns a copy of the string which can be used to construct references to services running in the engine.

The caller must free the contact string.

Parameters:
engine A service engine reference to get the contact stirng from.
contact A pointer which will be set to a copy of the engine's contact string.
Return values:
GLOBUS_SUCCESS Contact string successfully copied.
GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM One of engine or contact or is NULL.
GLOBUS_SERVICE_ENGINE_ERROR_TYPE_OUT_OF_MEMORY Insufficient memory to copy contact string.

globus_result_t globus_service_engine_init ( globus_service_engine_t *  new_engine,
globus_soap_message_attr_t  attrs,
const char *  port_contact,
globus_handler_chain_t  handlers,
globus_bool_t  enable_https 
)

Initialize a service engine

Creates a new service engine.

The service engine will be created on a new TCP port, but will not accept connections until either globus_service_engine_register_session() or globus_service_engine_register_start() is called.

Parameters:
new_engine Pointer to a globus_service_engine_t which will contain the handle to the new engine after this function returns successfully.
attrs Default SOAP Message attributes to use when this engine processes SOAP requests. This parameter may be NULL.
port_contact String containing the TCP port number to use for this service engine. This parameter may be NULL. If the string "0" is used, then a port will be chosen automatically.
handlers Chain of message handlers to use. If this is NULL, the handler chain will be derived from the default attributes. Experts only!
enable_https Use transport-level security (TLS) to authenticate and protect messages sent and received by this engine.
Return values:
GLOBUS_SUCCESS Engine initialized successfully.
GLOBUS_SERVICE_ENGINE_ERROR_TYPE_OUT_OF_MEMORY Insufficient memory to initialized the engine.
GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM The new_engine parameter is NULL.
GLOBUS_SERVICE_ENGINE_ERROR_TYPE_INIT_FAILED Internal error initializing the engine. The causal error will be generated by either
  • Globus XIO
  • Globus SOAP Message Attributes
  • Globus Handler Chain
GLOBUS_SERVICE_ENGINE_ERROR_TYPE_INVALID_CONTACT Invalid port_contact string.

globus_result_t globus_service_engine_lookup ( const char *  contact,
globus_service_engine_t *  engine 
)

Look up an engine based on its contact string

Determines if a service engine exists in the current process which handles is running with the given contact string.

If a service engine does exist, the engine parameter is modified to refer to it.

Parameters:
contact The service engine contact string to look up.
engine A pointer to an engine, which will be updated to contain a reference to the service engine. If no engine matches the contact, engine will be set to NULL.
Return values:
GLOBUS_SUCCESS Service engine lookup completed without error. Check that contact is non-NULL to determine if the engine was found.
GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM One of contact or engine is NULL.
GLOBUS_SERVICE_ENGINE_ERROR_TYPE_INVALID_CONTACT Unable to parse the contact string.
GLOBUS_SERVICE_ENGINE_ERROR_TYPE_OUT_OF_MEMORY Insufficient memory to look up contact.

globus_result_t globus_service_engine_register_process ( globus_service_engine_t  engine,
globus_soap_message_handle_t  message,
globus_result_t  fault_result,
globus_service_session_callback_func_t  callback,
void *  arg 
)

Begin processing a new SOAP request

Starts processing a SOAP message which has been initialized from a service engine handle.

The message handle is generated by the service engine after via the processing done in globus_service_engine_register_session(). Calling this function will parse the SOAP request and invoke the service which will handle the request. When all service operation requests on the handle have completed, the callback function will be called.

Parameters:
engine Service engine associated with the SOAP request.
message SOAP message handle associated with this new session. This is passed to the callback registered with globus_service_engine_register_session().
fault_result Fault message to return to the client in place of processing the request.
callback Callback function to call after the service engine has finished with this session.
arg Application-specific parameter to callback.
Return values:
GLOBUS_SUCCESS 

globus_result_t globus_service_engine_register_session ( globus_service_engine_t  engine,
globus_service_session_callback_func_t  callback,
void *  arg 
)

Register a new service session.

globus_result_t globus_service_engine_register_start ( globus_service_engine_t  engine,
globus_service_engine_callback_func_t  stop_callback,
void *  arg 
)

Start processing service requests

Starts registering callbacks to process service requests on a service engine.

The engine will continue to process new service requests until the globus_service_engine_register_stop() function is called.

Parameters:
engine Service engine to start.
stop_callback Callback to call after the engine has been stopped and all sessions have terminated.
arg Application-specific callback to stop_callback
Return values:
GLOBUS_SUCCESS Engine started successfully.
GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM The stop_callback parameter is NULL.
GLOBUS_SERVICE_ENGINE_ERROR_TYPE_ALREADY_STARTED The service engine has already been started.
GLOBUS_SERVICE_ENGINE_ERROR_TYPE_OUT_OF_MEMORY Insufficient memory to start the engine.

globus_result_t globus_service_engine_register_stop ( globus_service_engine_t  engine  ) 

Stop accepting new service sessions

Stops the engine from accepting any new sessions.

Currently active sessions will continue to be processed.

Parameters:
engine Engine to stop processing new sessions.
Return values:
GLOBUS_SUCCESS Engine has successfully stopped accepting new sessions.

globus_result_t globus_service_get_engine_contacts ( xsd_anyURI **  contacts,
globus_size_t *  contacts_length 
)

Get a list of contacts for all engines running in this process.

Allocates an array of xsd_anyURIs which will be set to contain the contact strings for all service engines running in this process. The variable pointed to by contacts_length will be set to the length of this array. It is the responsibility of the caller to free the contacts array. If there are no engines running in this process, contacts will be set to NULL and contacts_length will be set to 0.

Parameters:
contacts Pointer to an array which will be allocated to contain the list of contacts.
contacts_length Pointer to a variable which will hold the length of the contacts array.
Return values:
GLOBUS_SUCCESS Contacts list successfully created.
GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM One of contacts or contacts_length is NULL.
GLOBUS_SERVICE_ENGINE_ERROR_TYPE_OUT_OF_MEMORY Insufficient memory to copy contacts list.

globus_result_t globus_service_session_begin_response ( globus_soap_message_handle_t  message  ) 

Prepare the response buffer for a SOAP request.

globus_result_t globus_service_session_end_response ( globus_soap_message_handle_t  message  ) 

Serialize the end of a SOAP response.


about globus | grid research | globus toolkit | software development

Comments? webmaster@globus.org