[omniORB] Problems trying to user the Trader service

Sai-Lai Lo s.lo@uk.research.att.com
Fri, 7 Sep 2001 09:23:47 -0000


I guess you trader is running on top of Orbix. Older versions of Orbix fails
to response correctly to a _is_a invocation. The call is used internally in
omniORB to ensure the object reference is of the correct type in _narrow.
I'm afraid there is nothing you can do in omniORB to get around this
problem.

Sai-Lai


----- Original Message -----
From: "Sonal Agrawal" <soagrawa@genuity.com>
To: <omniorb-list@uk.research.att.com>
Sent: Tuesday, September 04, 2001 9:26 PM
Subject: [omniORB] Problems trying to user the Trader service


>
> Hello,
>
> I am trying to use the Trader service to get certain Factory agent
objects.
> I do get a valid traderLookupPtr however, I get an invalid ptr returned
from
> CosTrading::Lookup::_narrow(traderLookupRef) when I narrow it.  Hence, I
get
> an exception later when I do a traderLookupPtr->query(....).
>
> I am attaching the snipet of code below.  The traderLookupPtr is defined
as:
> CosTrading::Lookup_ptr traderLookupPtr;  in the header file.  I am able to
> succesfully execute a sample client written with Orbix by the vendor but
not
> this code using OmniOrb.   Do I need to set omniORB in a certain way?
> Please could someone help.
>
> Thanks,
>
> Sonal Agrawal
>
>
>
>   const char *traderIorPathname = "./TRADER_IOR";
>   FILE *traderIorFileHandle;
>   CORBA::String_var traderIor = CORBA::string_alloc(2048);
>   CORBA::Object_ptr traderLookupRef = 0;
>
>   cout << "Getting 'TradingService' reference...";
>
>   // Read the file to get the trader IOR
>   traderIorFileHandle=fopen(traderIorPathname, "r");
>   fgets(traderIor,2048, traderIorFileHandle);
>   fclose(traderIorFileHandle);
>
>   traderLookupRef = orb->string_to_object(traderIor);
>   if (CORBA::is_nil(traderLookupRef))
>   {
>     cout << "failed to get trader Ref!" << endl;
>         exit(-1);
>   }
>   else
>   {
>     traderLookupPtr = CosTrading::Lookup::_narrow(traderLookupRef);
>     cout << "done!" << endl;
>   }
>
>
>  if (CORBA::is_nil(traderLookupPtr))
>   {
>     cout << "failed to get trader Ptr!" << endl;
>         exit(-1);   // ************ programs exits here
>   }
>   else
>   {
>     cout << "done!  Ready to use the Trader" << endl;
>   }
>
>
>