•
|
Use the CORBA::Object::_request member function.
|
Use the CORBA::Object::_request member function to create an empty request object specifying only the interface name you intend to invoke in the request (for example,
get_course_details). Once the request object is created, the arguments, if there are any, must be added before the request can be sent to the CORBA server application. You invoke the
CORBA::NVList::add_value member function for each argument required by the method you intend to invoke.
You must also specify the type of the request’s result using the CORBA::Request::result member function. For performance reasons, the messages exchanged between Object Request Brokers (ORBs) do not contain type information. By specifying a place holder for the result type, you give the ORB the information it needs to properly extract the result from the reply. Similarly, if the method you are invoking can raise user exceptions, you must add a place holder for exceptions before sending the request object.
•
|
Use the CORBA::Object::_create_request member function.
|
When you use the CORBA::Object:: _create_request member function to create a request object, you pass all the arguments required to make the request and to specify the types of the result and user exceptions, if there are any, that the request may return. Using this member function, you create an empty NVList, add arguments to the NVList one at a time, and create the request object, passing the completed NVList as an argument to the request. The potential advantage of the
CORBA::Object::_create_request member function is performance. You can reuse the arguments in multiple
CORBA::ORB::_create_request calls if you invoke the same method on multiple target objects.
•
|
Use the CORBA::Request::send_oneway member function if, and only if, the CORBA method has been defined as oneway in the OMG IDL file.
|
Note:
|
When using the CORBA::Request::send_deferred member function, the invocation on the request object acts synchronously when the target object is in the same address space as the CORBA client application issuing the invocation. As a result of this behavior, calling the CosTransaction::Current::suspend operation does not raise the CORBA::BAD_IN_ORDER exception, because the transaction has completed.
|
If you used the CORBA::Request::send_oneway member function, there is no result.
idl2ir [-f repositoryfile.idl] file.idl
When you use the CORBA::Object::create_request member function to create a request object, you create an empty NVList and you add arguments to the NVList one at a time. You create the request object, passing the completed NVList as an argument to the request.
The CORBA::NamedValue member function specifies a named/value object that can be used to represent both input and output arguments for a request. The named/value objects are used as arguments to the request object. The
CORBA::NamedValue pair is also used to represent the result of a request that is returned to the CORBA client application. The name property of a named/value object is a character string, and the value property of a named/value object is represented by a CORBA
Any.
If you want synchronous communication, the CORBA::Request::invoke member function sends the request and waits for a response before it returns to the CORBA client application. Use the
CORBA::Request::result member function to return a reference to a named/value object that represents the return value. Once the results are retrieved, you read the values from the NVList stored in the request.
The nonblocking member function, CORBA::Request::send_deferred, is also provided for sending requests. It allows the CORBA client application to send a request and then use the
CORBA::Request::poll_response member function to determine when the response is available. The
CORBA::Request::get_response member function blocks until a response is available.
Use the CORBA::Request::send_oneway member function to send a oneway request. Oneway requests do not involve a response from the CORBA server application. For a complete description of the
CORBA::Request::send_oneway member function, see the
CORBA Programming Reference.
When a sequence of request objects is sent using the CORBA::Request::send_multiple_requests_deferred member function, the
CORBA::ORB::poll_response, CORBA::ORB::poll_next_response, CORBA::ORB::get_response, and
CORBA::ORB::get_next_response member functions can be used to retrieve the response the CORBA server application sends for each request.
The CORBA::ORB::poll_response and
CORBA::ORB::poll_next_response member functions can be used to determine if a response has been retrieved from the CORBA server application. These member functions return a 1 if there is at least one response available, and a zero if there are no responses available.
The CORBA::ORB::get_response and
CORBA::ORB::get_next_response member functions can be used to retrieve a response. If no response is available, these member functions block until a response is retrieved. If you do not want your CORBA client application to block, use the
CORBA::ORB::poll_next_response member function to first determine when a response is available, and then use the
CORBA::ORB::get_next_response method to retrieve the result.
CORBA::Context_ptr ctx;
CORBA::Request_ptr requests[2];
CORBA::Request_ptr request;
CORBA::NVList_ptr arg_list1, arg_list2;
CORBA::ULong i, nreq;
CORBA::Long arg1 = 1;
Boolean aResult1 = CORBA_FALSE;
Boolean expected_aResult1 = CORBA_TRUE;
CORBA::Long arg2 = 3;
Boolean aResult2 = CORBA_FALSE;
Boolean expected_aResult2 = CORBA_TRUE
try
{
orbp->get_default_context(ctx);
populate_arg_list ( &arg_list1, &arg1, &aResult1 );
nreq = 0;
anObj->_create_request ( ctx,
“Multiply”,
arg_list1,
0,
requests[nreq++],
0);
populate_arg_list ( &arg_list2, &arg2, &aResult2 );
anObj->_create_request ( ctx,
“Multiply”,
arg_list2,
0,
requests[nreq++],
0 );
// Declare a request sequence variable...
CORBA::ORB::RequestSeq rseq ( nreq, nreq, requests, CORBA_FALSE );
orbp->send_multiple_requests_deferred ( rseq );
for ( i = 0 ; i < nreq ; i++ )
To delete the entire request, use the CORBA::Release(request) member function on the request to be deleted. This operation releases all memory associated with the request. Deleting a request that was issued using the deferred synchronous communication type causes that request to be canceled if it has not completed.
1.
|
Set ORB_INCLUDE_REPOSITORY in CORBA.h to the location of the Interface Repository file in your Oracle Tuxedo system.
|
3.
|
Use the CORBA::Object::_get_interface member function to communicate with the CORBA server application that implements the desired CORBA object.
|
4.
|
Use CORBA::InterfaceDef_ptr to get the definition of the CORBA interface that is stored in the Interface Repository.
|
5.
|
Locate the OperationDescription for the desired operation in the FullInterfaceDescription operations.
|
7.
|
Call CORBA::Repository::lookup_id using the repository ID returned in the OperationDescription to look up the OperationDef in the Interface Repository. This call returns the contained object.
|
9.
|
Use the CORBA::ORB::create_operation_list member function, using the OperationDef argument, to build an argument list for the operation.
|