IiopSetServiceContext Function

Action

For an object, specifies the service context list that is sent along with messages that are exchanged between server and client objects. Usually the service context list contains information that is not visible to a developer using an ORB.

A service context list is held globally for a CORBA object. This means that the service context list is sent unchanged with every IiopRequest function call, unless a new service context list is created, using the functions IiopBeginServiceContext, IiopEndServiceContext, IiopSetServiceContext or IiopDeleteServiceContextList.

However, if a service context list is defined for a callback object using the same functions, it is bound to a special operation defined by IiopObjectListen. Any time this operation is invoked by the server, Silk Performer returns the service context list along with the IIOP reply message.

Include file

IIOP.bdh

Syntax

IiopSetServiceContext( in hIiop           : number,
                       in sServContext    : string,
                       in nServContextLen : number optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hIiop Handle to a CORBA object.
sServContext Buffer containing the service context.
nServContextLen Length of the service context (optional).

Example

dcltrans
  transaction TServiceContext
  const
    HOST           := "192.168.20.21"; // server
    PORT           := 1052;            // port
    KEY            := "...\h00";       // key
    KEYLEN         := 4;               // key length
    SERVICECONTEXT := "\h00000001000000010000000C00000000"
"\h0001010001000001";
  var
    hIiop : number;
  begin
    // general settings
    IiopSetMaxGiopVersion("1.2");
    IiopSetByteOrder(IIOP_BIG_ENDIAN);

    // retrieve handle to server
    IiopObjectCreate(hIiop, "IDL:DemoObject:1.0", "1.2", HOST, PORT, KEY);

    // set service context
    if IiopSetServiceContext(hIiop, SERVICECONTEXT) then
      writeln("service context successfully set");
    end;

    IiopRequest(hIiop, "Request");
    IiopObjectRelease(hIiop);
  end TServiceContext;

Output

service context successfuly set