[Enterprise Extensions only]

Object::_request

Overview Creates a Request object suitable for invoking a specific operation using the Dynamic Invocation Interface (DII).
Original class CORBA::Object
Exceptions CORBA::SystemException


Intended Usage

The _request method is used to create a CORBA::Request object tailored to a specific IDL operation. Arguments, the operation's return type, and context identifiers should be added after construction via methods on CORBA::Request. The CORBA::Request object can then be used to invoke requests using the Dynamic Invocation Interface (DII). After invoking the method, an application can obtain the return results, output parameter values, and exceptions via methods on CORBA::Request.

The target of the CORBA::Object::_request method is typically a proxy object, rather than a local object. When invoked on a proxy object, this method operates locally; the remote object to which the proxy refers is unaffected until the DII Request that is created by CORBA::Object::_request is invoked.

This mechanism for creating a CORBA::Request assumes that the operation to be invoked via the DII is not "oneway" (that a response is required).

See also CORBA::Object::_create_request, which allows the CORBA::Request to be created and fully initialized at once.

IDL Syntax

  virtual CORBA::Request_ptr _request (const char* operation) = 0;

Input parameters

operation
The unscoped name of the IDL operation to be invoked using the Request. This must be an operation that is implemented or inherited by the CORBA::Object on which CORBA::Object::_create_request is invoked. The caller retains ownership of this parameter (the CORBA::Request object makes a copy).

Return values

CORBA::Request_ptr
A pointer to the newly-created CORBA::Request object. The caller assumes ownership of this object and should subsequently delete it.

Example

  /* The following C++ fragment creates a request object assuming
     that p is a proxy object pointer already declared and defined 
   */
  #include "corba.h"
  CORBA::Request_ptr req = p->_request("dii_string_tst";
  CORBA::String str = CORBA::string_alloc(12+1);
  strcpy( str, "Input String");
  req->add_in_arg() <<= str;
  req->set_return_type(CORBA::_tc_string);
  req->invoke();
  ...
  CORBA::string_free(str);
  CORBA::release(req);