Locating services

The Service Access framework provides facilities that a server uses to publish its services (making them available for clients to access) and clients use to identify services they need to connect to.

The Service Access framework distinguishes a server from a service:

Specifically, this framework deals with defining, publishing, and locating services, not servers. Each service might be part of a server containing other services or might be the only service offered on a server.

Defining services

A server publishes a service by creating and activating a service definition. This service definition represents a specific service access point--a point to which clients can connect to the service. Creating a service definition is the first step in establishing client-server communication on the server side--a client cannot reference a server that is not published, and a server cannot open a communications channel without a definition.

Clients that want to reference a service do so by creating or obtaining a service reference. A service reference acts as a pointer to a service definition, providing the client with an access point through which the client can communicate with the service. This access point can point to a local service or to a service across a network (or other communications service) on another host.

A service has only one service definition and a client has only one service reference to a particular service. But because a service can have multiple clients, many clients can reference a single service at one time. For example, a service might have two clients on the same host (occupying different tasks) and one client on another host. In this case, three service references correspond to a single service definition.


Service Access classes

You create service definitions and service references using classes that derive from TServiceDefinition and TServiceReference.

When you instantiate a service definition, you use TStandardServiceDefinition, a wrapper class. Based on the parameters you use to construct the TStandardServiceDefinition, the class determines whether to create a TLocalServiceDefinition (for a service visible only to clients on the same host) or a TNetworkServiceDefinition (for a service visible to clients across a network).


For service references, you directly instantiate one of the two classes that derive from TServiceReference. Which class you use--TLocalServiceReference or TNetworkServiceReference--depends on the visibility of the service you want to connect to.


Characteristics of services

When you construct a service definition, you specify:

You represent a service name using an instance of
TLocalObjectName and the service visibility using a TQualityOfService object.


If you don't provide a local object name and define the quality of service, TStandardServiceDefinition constructs an unnamed service. Unnamed services are not visible to any clients. The only way a client can access an unnamed service is if the service itself creates the service reference and passes it directly to the client.

Publishing and activating services

A service definition is published when it is activated. You activate a service--making it available for a client connection--when you pass it into a message stream, and thus establish a communications channel. Until you publish and activate a service, clients cannot locate or connect to the service.

The same is true for service references. Once you create a valid service reference, your client has a service access point to the service, but can't yet transfer data to it. When you then instantiate a message stream and pass the service reference in, you can start to move data between the client and service.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker