ORB::object_to_string

Overview Converts an object reference to an external form that can be stored outside the ORB or exchanged between processes.
Original class CORBA::ORB
Exceptions CORBA::SystemException


Intended Usage

The CORBA::ORB::object_to_string method is intended to be used by client or server applications to convert object references (either proxy objects or local objects) to a string form that has meaning outside the process. The CORBA::ORB::string_to_object can then be used to reconstitute the object reference (either in the same process or a different process). The output string is compliant with the CORBA 2.1 specification for Interoperable Object References.

If the caller is a server (that it, the caller has already invoked CORBA::BOA::impl_is_ready), and the input object reference is a local object, then the resulting string can be passed to CORBA::ORB::string_to_object to construct a proxy in another process, or to obtain the original object pointer in the same process.

If the caller is not a server and the input object reference is a local object (rather than a proxy), then the result of CORBA::ORB::object_to_string is valid only within the calling process for the lifetime of the process and as long as the input object resides in the process.

Syntax

  char * object_to_string (CORBA::Object_ptr obj);

Input parameters

obj
The object reference to be converted to string form. Nil object references are valid.

Return values

char *
The string form of the input object reference (either a proxy object or a local object). The caller assumes ownership of this string and should subsequently free it using CORBA::string_free.

Example

  /* convert local object to string representation. Assume that p is
     a local object pointer already declared and defined of a class,
     say Foo
   */
  #include "corba.h"
  #include   ...
  /* assume op initialized */
  extern CORBA::ORB_ptr op;
  CORBA::string str = op->object_to_string(p);
  CORBA::Object_ptr objPtr = op->string_to_object(str);
  /* narrow down objPtr by calling Foo::_narrow(objPtr),
     get back a local obj same as p ...
   */
  CORBA::string_free(str);
  CORBA::release(objPtr);
  ...

Related reference
CORBA module



Searchable topic ID:   rcor_modo27
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/corba/ref/rcor_modo27.html

Library | Support | Terms of Use | Feedback