IiopGetServiceContextList Function

Action

Reads off a list of service contexts that may have been added to the reply of an IIOP request. The contents of the list can be retrieved by using the IiopGet functions on the handle that has been returned.

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

IiopGetServiceContextList( in    hIiop   : number,
                           inout hSrvCtx : number): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hIiop Handle to a CORBA object.
hSrvCtx Handle to a parser object containing the service context.

Example

dcltrans
  transaction TServiceContext
  const
    HOST   := "192.168.20.21"; // server
    PORT   := 1052; // port
    KEY    := "...\h00"; // key
    KEYLEN := 4; // key length
  var
    hIiop   : number; // handle to CORBA object
    hSrvCtx : number; // handle to service context
    hEnc    : number; // handle to a parser object that contains an
    // encapsulation (IIOP data block)
    i          : number;
    nServCtxId : number;
  begin
    IiopSetMaxGiopVersion("1.2");
    IiopSetByteOrder(IIOP_BIG_ENDIAN);

    // retrieve handle to server
    IiopObjectCreate(hIiop, "IDL:DemoObject:1.0", "1.2",
                     HOST, PORT, KEY, KEYLEN);
    
    // create service context
    IiopBeginServiceContext(hIiop, 1, IIOP_LITTLE_ENDIAN);
    IiopSetUlong(hIiop, 0x1010);
    IiopSetUlong(hIiop, 0x0110);
    IiopEndServiceContext(hIiop);

    // pass long value parameter to request
    IiopSetLong(hIiop, 593814064);
    // call request "DecToHex" with long parameter
    IiopRequest(hIiop, "DecToHex");
    IiopGetServiceContextList(hIiop, hSrvCtx);
    
    for i := 1 to IiopGetLong(hSrvCtx);
      IiopGetLong(hSrvCtx, nServCtxId);
      IiopGetEncapsulation(hSrvCtx, hEnc);
      if nServCtxId = 0 then
        IiopGetLong(hEnc);
        ...
      end;
    end;

    ...
    IiopParserRelease(hSrvCtx);
    IiopParserRelease(hEnc);
    IiopObjectRelease(hIiop);
  end TServiceContext;