IiopGetServiceContext Function

Action

Gets the service context list for an object that has been sent along with a message from a server object. 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

IiopGetServiceContext( in  hIiop        : number,
                       out sContext     : string,
                       in  nContextSize : number optional,
                       out nUsed        : number optional): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hIiop Handle to a CORBA object.
sContext String variable that receives the service context.
nContextSize Size of the string variable that receives the service context (optional).
nUsed Variable that receives the number of bytes that are copied to the buffer (optional).

Example

dcltrans
  transaction TServiceContext
  var
    sBuf : string();
  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);
    IiopRequest(hIiop, "ARequest");

    // get service context
    IiopGetServiceContext(hIiop, sBuf)
    WriteData(sBuf, STRING_COMPLETE, OPT_WRITEDATA_HEX);
    IiopObjectRelease(hIiop);
  end TServiceContext;