Creating and using a named server – PB Docs 80

Creating and using a named server

Using your own named server involves these steps:

  1. Define the objects
    you will access.
  2. Build the runtime libraries for those objects.
  3. Register your server in the registry.
  4. Write code in the client that connects to your server,
    creates objects, and accesses their methods and properties.

Creating the user objects you will access

Defining user objects for use in a named server is the same
as for PowerBuilder.Application.

For information, see “Creating the user
objects you will access”
.

Building runtime libraries

Building runtime libraries for use in a named server is the
same as for PowerBuilder.Application.

For information, see “Building runtime libraries”.

Registering the server

You can use the Automation Server project wizard to register
your server, as described in “Registering the object”.

To register your server, rather than a single user object,
select PowerBuilder.Application as the component. Proceed as described
in “Registering the object” and
install the registry update file in the registry. You do not need
to create a type library file for a named server.

Writing client code that accesses the server
and user objects

A client application that wants to establish a session with
your named server needs code to:

  • Connect to the server
  • Instantiate objects
  • Access those objects

The following steps with code examples illustrate how to do
it. The examples are client code for PowerBuilder. All the steps of
the process should be accompanied by error checking because there
are any number of reasons why server sessions can fail.

  1. Declare one OLEObject
    variable for your server. Declare additional OLEObject variables
    for each object you will create:

    If you want to handle errors in the OLEObject ExternalException
    and Error events, use a user object inherited from OLEObject instead.

  2. Start the automation server and check that the connection
    was established. A status of 0 indicates success:

  3. Create the first object you want to use and check
    for success. Specify the object’s name as defined in the
    library:

  4. Access functions or properties of the object using
    automation syntax. (These properties and methods are hypothetical.)

  5. Disconnect from the server and destroy the objects
    when you are done. (Exiting your application also accomplishes this.)


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x