Creating an object in a specific server

The following example demonstrates how a client application creates a new object in a remote server chosen by the client. The DSOM Object Manager method somdFindServerByName is used to find and create a proxy to the server object for the server implementation named "myCarServer". The method somdCreateObj is then invoked on the server object to create the remote "Car". A proxy to the remote "Car" is returned. (The "Stack" client presented in the previous section used the same methods to create a remote "Stack".)

 /* find a specific Car server */
    server =
      _somdFindServerByName(SOMD_ObjectMgr, &ev, "myCarSe           rver");

 /* create a remote Car object on that server */
    car = _somdCreateObj(server, &ev, "Car", "");
    ...
}

Note: If the specified server does not provide any implementation of the desired class, a NULL pointer will be returned and a "ClassNotFound" exception will be raised.