Creating a Web Service Type from TclOverviewWebservice 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 PackageTo 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 typeProcedure 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 fieldInfo is: {type typeName comment commentString}, typeName can be any simple or defined type and_commentString is a quoted string describing the field.
Returns: Nothing Side-Effects: None Exception Conditions: None Pre-requisite Conditions: None Defining a derived typeProcedure 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
- definitione
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 fieldInfo consist of:
- 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 definitionProcedure 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 fieldInfo is: {type typeName comment commentString}, typeName can be any simple or defined type and commentString is a quoted string describing the field.
Side-Effects: None Exception Conditions: None Pre-requisite Conditions: The service must be defined.
|