<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1141" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>I have set up the
echo example on the sun kit along with a client and all works from pure java. I
am using the POA - Tie example but using your echo program instead of the hello
sun demo.</FONT></SPAN></DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>I have modified the
eg3_clt and have gotten the name servers to talk and connect but I get a nil
client return. I have tried using the -ORBverifyObjectExistsAndType 0 arg on the
command line. I have VC++ 6.0 installed, but have compiled from your echo
directory. I am using windows XP, and have both client and server executing on
one box.</FONT></SPAN></DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>It appears the
object is nil after the narrow request.</FONT></SPAN></DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>// eg3_clt.cc - This
is the source code of example 3 used in Chapter
2<BR>//
"The Basics" of the omniORB user
guide.<BR>//<BR>//
This is the client. It uses the COSS naming
service<BR>//
to obtain the object reference.<BR>//<BR>// Usage:
eg3_clt<BR>//<BR>//<BR>// On startup,
the client lookup the object reference from
the<BR>// COS naming
service.<BR>//<BR>// The name which
the object is bound to is as
follows:<BR>//
root
[context]<BR>//
|<BR>//
text [context] kind
[my_context]<BR>//
|<BR>//
Echo [object] kind [Object]<BR>//</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>#include
<iostream.h><BR>#include <echo.hh></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>static
CORBA::Object_ptr getObjectReference(CORBA::ORB_ptr orb);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>static void
hello(Echo_ptr e)<BR>{<BR> if( CORBA::is_nil(e) ) {<BR>
cerr << "hello: The object reference is nil!\n" <<
endl;<BR> return;<BR> }</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>
CORBA::String_var src = (const char*) "Hello!";</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>
CORBA::String_var dest = e->echoString(src);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2> cerr <<
"I said, \"" << (char*)src << "\"." <<
endl<BR> << "The Echo object replied,
\"" << (char*)dest <<"\"." << endl;<BR>}</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial
size=2>//////////////////////////////////////////////////////////////////////</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>int<BR>main (int
argc, char **argv)<BR>{<BR> try {<BR> CORBA::ORB_var orb
= CORBA::ORB_init(argc, argv);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>
CORBA::Object_var obj = getObjectReference(orb);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>
Echo_var echoref = Echo::_narrow(obj);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>
for (CORBA::ULong count=0; count < 10;
count++)<BR> hello(echoref);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>
orb->destroy();<BR> }<BR> catch(CORBA::COMM_FAILURE& ex)
{<BR> cerr << "Caught system exception COMM_FAILURE --
unable to contact the "<BR>
<< "object." << endl;<BR> }<BR>
catch(CORBA::SystemException&) {<BR> cerr << "Caught
CORBA::SystemException." << endl;<BR> }<BR>
catch(CORBA::Exception&) {<BR> cerr << "Caught
CORBA::Exception." << endl;<BR> }<BR>
catch(omniORB::fatalException& fe) {<BR> cerr <<
"Caught omniORB::fatalException:" << endl;<BR> cerr
<< " file: " << fe.file() << endl;<BR>
cerr << " line: " << fe.line() <<
endl;<BR> cerr << " mesg: " << fe.errmsg()
<< endl;<BR> }<BR> catch(...) {<BR> cerr
<< "Caught unknown exception." << endl;<BR>
}</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2> return
0;<BR>}</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial
size=2>//////////////////////////////////////////////////////////////////////</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>static
CORBA::Object_ptr<BR>getObjectReference(CORBA::ORB_ptr orb)<BR>{<BR>
CosNaming::NamingContext_var rootContext;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2> try
{<BR> // Obtain a reference to the root context of the Name
service:<BR> CORBA::Object_var obj;<BR> obj
= orb->resolve_initial_references("NameService");</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>
// Narrow the reference returned.<BR> rootContext =
CosNaming::NamingContext::_narrow(obj);<BR> if(
CORBA::is_nil(rootContext) ) {<BR> cerr <<
"Failed to narrow the root naming context." <<
endl;<BR> return
CORBA::Object::_nil();<BR> }<BR> }<BR>
catch(CORBA::ORB::InvalidName& ex) {<BR> // This should
not happen!<BR> cerr << "Service required is invalid
[does not exist]." << endl;<BR> return
CORBA::Object::_nil();<BR> }</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2> // Create a
name object, containing the name test/context:<BR> CosNaming::Name
name;<BR> name.length(1);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=451260401-06082003><FONT face=Arial size=2>//
name[0].id = (const char*)
"test"; // string copied<BR>//
name[0].kind = (const char*) "my_context"; // string copied<BR>//
name[1].id = (const char*) "Echo";<BR>// name[1].kind = (const
char*) "Object";<BR> name[0].id = (const char*)
"Echo";<BR> name[0].kind = (const char*) "";<BR> // Note on kind:
The kind field is used to indicate the type<BR> // of the object. This is
to avoid conventions such as that used<BR> // by files (name.type -- e.g.
test.ps = postscript etc.)</FONT></SPAN></DIV>
<DIV> </DIV><SPAN class=451260401-06082003>
<DIV><BR><FONT face=Arial size=2> try {<BR> // Resolve
the name to an object reference.<BR> cerr << "Context
not found." << endl;<BR> return
rootContext->resolve(name);<BR> }<BR>
catch(CosNaming::NamingContext::NotFound& ex) {<BR> //
This exception is thrown if any of the components of the<BR>
// path [contexts or the object] aren't found:<BR> cerr
<< "Context not found." << endl;<BR> }<BR>
catch(CORBA::COMM_FAILURE& ex) {<BR> cerr << "Caught
system exception COMM_FAILURE -- unable to contact the
"<BR> << "naming service."
<< endl;<BR> }<BR> catch(CORBA::SystemException&)
{<BR> cerr << "Caught a CORBA::SystemException while
using the naming service."<BR> << endl;<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> return
CORBA::Object::_nil();<BR>}<BR></FONT></DIV></SPAN></FONT></DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Arial size=2>--</FONT></DIV>
<DIV align=left><FONT face=Arial size=2></FONT> </DIV>
<DIV align=left><FONT face=Arial size=2>Cheers,</FONT></DIV>
<DIV align=left><FONT face=Arial size=2></FONT> </DIV>
<DIV align=left><FONT face=Arial size=2>You can have it fast, cheap and good,
but you only get to pick 2.</FONT></DIV>
<DIV align=left><FONT face=Arial size=2></FONT> </DIV>
<DIV align=left><FONT face=Arial size=2>(608) 242-4100 x32610</FONT></DIV>
<DIV> </DIV></BODY></HTML>