Update of "Defining Types"
Not logged in
EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: a4e53bb02954b37e66496dc9c577fe74c66210a0
Page Name:Defining Types
Date: 2011-02-26 02:46:31
Original User: gerald
Parent: f1c526854849d056af80364873d44b9858480b89 (diff)
Next 6b0303a30f862c4e089bb8f5e2eb42c561ab4e75
Content

Contents

Overview

Webservice Type declaration is part of the Webservices Utility package.

When writing a web service it is often requried to write a complex type definition for an argument containing structured data.

When calling an operation on a web service it is sometimes convient to define a complex type to return structured data as an XML fragment even though the sevice may state that it is only expecting a string.

Loading the Webservices Utility Package

To load the webservices server package, do:

 package require WS::Utils

This command will only load the utilities the first time it is used, so it causes no ill effects to put this in each file using the utilties.


Defining a type

Procedure Name : ::WS::Utils::ServiceTypeDef

Description : Define a type for a service.

Arguments :

     mode            - Client or Server
     service         - The name of the service this type definition is for
     type            - The type to be defined/redefined
     definition      - The definition of the type's fields.  This consist of one
                           or more occurance of a field definition.  Each field definition
                           consist of:  fieldName fieldInfo
                           Where field info is: {type typeName comment commentString}
                              typeName can be any simple or defined type.
                              commentString is a quoted string describing the field.

Returns : Nothing

Side-Effects : None

Exception Conditions : None

Pre-requisite Conditions : None


Defining a derived type

Procedure Name : ::WS::Utils::ServiceSimpleTypeDef

Description : Define a derived type for a service.

Arguments :

     mode            - Client or Server
     service         - The name of the service this type definition is for
     type            - The type to be defined/redefined
     definition      - The definition of the type's fields.  This consist of one
                           or more occurance of a field definition.  Each field definition
                           consist of:  fieldName fieldInfo
                           Where: {type typeName comment commentString}
                              baseType typeName - any simple or defined type.
                              comment commentString - a quoted string describing the field.
                              pattern value
                              length value
                              fixed "true"|"false"
                              maxLength value
                              minLength value
                              minInclusive value
                              maxInclusive value
                              enumeration value

Returns : Nothing

Side-Effects : None

Exception Conditions : None

Pre-requisite Conditions : None


Getting a type definition

Procedure Name : ::WS::Utils::GetServiceTypeDef

Description : Query for type definitions.

Arguments :

     mode            - Client or Server
     service         - The name of the service this query is for
     type            - The type to be retrieved (optional)

Returns :

     If type not provided, a dictionary object describing all of the types
     for the service.
     If type provided, a dictionary object describing the type.
       A definition consist of a dictionary object with the following key/values:
         xns         - The namespace for this type.
         definition  - The definition of the type's fields.  This consist of one
                       or more occurance of a field definition.  Each field definition
                       consist of:  fieldName fieldInfo
                       Where field info is: {type typeName comment commentString}
                         typeName can be any simple or defined type.
                         commentString is a quoted string describing the field.

Side-Effects : None

Exception Conditions : None

Pre-requisite Conditions : The service must be defined.