f



Example CORBA server that is also a Client to another server

I'm just new to CORBA and having a hard time to create a program that
is a CORBA server that is also a client to another server. I've done
the server part, and it works somehow (got a test client that connects
to it), now i'm having trouble with the client part. I placed the ORB
initialization, binding, etc in the constructor (for being the
client). It compiles but I'm getting CORBA exception error which I
don't know what it means.  Using catior, the nameservice does not
appear. Does anyone have these application before and has an example
code or template where I can base my code.

Here is part of the code, basically the constructor part. i omitted
some part though. I think this is the part where I'm having problems.
The values for "nameservice", "contextid", "context", "objectid" and
"object" is correct. When I run the program, I can still see the
"Resolving name text identifier" text. However after that, "Caught
CORBA::Exception" is printed. Please help. Tnx.

// Class declaration
class DPIQuery_i : public virtual POA_DPIQuery,
    public PortableServer::RefCountServantBase
{
    public:
        DPIQuery_i();
        ~DPIQuery_i();
        retInquire dpi_inquire(...) throw(CORBA::SystemException);
        CORBA::Short dpi_deduct(...) throw(CORBA::SystemException);

        adaptor_var adp_Data;
};

// Constructor
DPIQuery_i::DPIQuery_i()
{
    int argc=5;
    char *argv[21];

    argv[0]= "dummy";
    argv[1]= "-ORBInitRef";

    argv[2]=nameservice;
    argv[3]=object;
    argv[4]=context;
    //argv[5]=0;

    cout << "Contextid: " << contextid << endl;
    cout << "Context: " << context << endl;
    cout << "Objectid: " << objectid << endl;
    cout << "Object: " << object << endl;

    cout << eira_nameservice << endl;
    try
    {
        CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);

        cout << "Binding EIRA ORB object" << endl;
        CORBA::Object_var obj = orb-
>resolve_initial_references("NameService");
        if (CORBA::is_nil(obj) )
        {
            cout << "Cannot resolve initial ref" << endl;
        }

        CORBA::String_var sior(orb->object_to_string(obj));
        cerr << "'" << (char *)sior << "'" << endl;

        cout << "Narrowing to the naming context" << endl;
        CosNaming::NamingContext_var rootContext =
CosNaming::NamingContext::_narrow(obj);
        if ( CORBA::is_nil(rootContext) )
        {
            cerr << "Failed to narrow the root naming context" <<
endl;
        }

        CosNaming::Name name;
        name.length(2);

        name[0].id   = (const char*) contextid;       // string copied
        name[0].kind   = (const char*) context;       // string copied
        name[1].id   = (const char*) objectid;       // string copied
        name[1].kind   = (const char*) object;       // string copied

        cout << "Resolving name text identifier" << endl;
        CORBA::Object_var obj1 = rootContext->resolve(name);
        if ( CORBA::is_nil(obj1) )
        {
           cerr << "Failed to resolve identfier" << endl;
        }

        adp_Data = adaptor::_narrow(obj1.in());

        if ( CORBA::is_nil(adp_Data.in()))
        {
            cerr << "IOR is not an SA object reference" << endl;
        }
    }
    catch (CORBA::COMM_FAILURE& ex)
    {
        cerr << "Caught system exception COMM_FAILURE -- unable to
contact the object" << endl;
        return;
    }
    catch (CORBA::SystemException&)
    {
        cerr << "Caught a CORBA::SystemException " << endl;
        return;
    }
    catch (CORBA::Exception&)
    {
        cerr << "Caught CORBA::Exception" << endl;
        return;
    }
    catch ( omniORB::fatalException& fe )
    {
        cerr << "Caught omniORB::fatalException:" << endl;
        cerr << "  file: " << fe.file() << endl;
        cerr << "  line: " << fe.line() << endl;
        cerr << "  mesg: " << fe.errmsg() << endl;
        return;
    }
catch(...)
    {
        cerr << "Caught unknown exception." << endl;
        return;
    }
    return;

}
0
ATAboy
2/14/2008 6:10:37 AM
comp.object.corba 1304 articles. 0 followers. Post Follow

4 Replies
671 Views

Similar Articles

[PageSpeed] 7

On Feb 14, 1:10 am, ATAboy <tipidpc.ata...@gmail.com> wrote:
[snip]
> Here is part of the code, basically the constructor part. i omitted
> some part though. I think this is the part where I'm having problems.
> The values for "nameservice", "contextid", "context", "objectid" and
> "object" is correct. When I run the program, I can still see the
> "Resolving name text identifier" text. However after that, "Caught
> CORBA::Exception" is printed. Please help. Tnx.
>
[snip]
>
>         CosNaming::NamingContext_var rootContext =
> CosNaming::NamingContext::_narrow(obj);
>         if ( CORBA::is_nil(rootContext) )
>         {
>             cerr << "Failed to narrow the root naming context" <<
> endl;
>         }
>
>         CosNaming::Name name;
>         name.length(2);
>
>         name[0].id   = (const char*) contextid;       // string copied
>         name[0].kind   = (const char*) context;       // string copied
>         name[1].id   = (const char*) objectid;       // string copied
>         name[1].kind   = (const char*) object;       // string copied
>
>         cout << "Resolving name text identifier" << endl;
>         CORBA::Object_var obj1 = rootContext->resolve(name);
>         if ( CORBA::is_nil(obj1) )
>         {
>            cerr << "Failed to resolve identfier" << endl;
>         }
>
>         adp_Data = adaptor::_narrow(obj1.in());
>
>         if ( CORBA::is_nil(adp_Data.in()))
>         {
>             cerr << "IOR is not an SA object reference" << endl;
>         }
>     }
>     catch (CORBA::COMM_FAILURE& ex)
>     {
>         cerr << "Caught system exception COMM_FAILURE -- unable to
> contact the object" << endl;
>         return;
>     }
>     catch (CORBA::SystemException&)
>     {
>         cerr << "Caught a CORBA::SystemException " << endl;
>         return;
>     }
>     catch (CORBA::Exception&)
>     {
>         cerr << "Caught CORBA::Exception" << endl;
>         return;
>     }

I don't know omniORB, but I think that
CosNaming::NamingContext::resolve() will raise a NotFound exception if
the requested object cannot be found (instead of returning a nil
reference).
0
ISO
2/14/2008 2:24:39 PM
On 14 Peb, 22:24, "=C9ric Malenfant" <Eric.Malenf...@gmail.com> wrote:
> On Feb 14, 1:10 am, ATAboy <tipidpc.ata...@gmail.com> wrote:
> [snip]
>
>
>
> > Here is part of the code, basically the constructor part. i omitted
> > some part though. I think this is the part where I'm having problems.
> > The values for "nameservice", "contextid", "context", "objectid" and
> > "object" is correct. When I run the program, I can still see the
> > "Resolving name text identifier" text. However after that, "Caught
> > CORBA::Exception" is printed. Please help. Tnx.
>
> [snip]
>
> >         CosNaming::NamingContext_var rootContext =3D
> > CosNaming::NamingContext::_narrow(obj);
> >         if ( CORBA::is_nil(rootContext) )
> >         {
> >             cerr << "Failed to narrow the root naming context" <<
> > endl;
> >         }
>
> >         CosNaming::Name name;
> >         name.length(2);
>
> >         name[0].id   =3D (const char*) contextid;       // string copied=

> >         name[0].kind   =3D (const char*) context;       // string copied=

> >         name[1].id   =3D (const char*) objectid;       // string copied
> >         name[1].kind   =3D (const char*) object;       // string copied
>
> >         cout << "Resolving name text identifier" << endl;
> >         CORBA::Object_var obj1 =3D rootContext->resolve(name);
> >         if ( CORBA::is_nil(obj1) )
> >         {
> >            cerr << "Failed to resolve identfier" << endl;
> >         }
>
> >         adp_Data =3D adaptor::_narrow(obj1.in());
>
> >         if ( CORBA::is_nil(adp_Data.in()))
> >         {
> >             cerr << "IOR is not an SA object reference" << endl;
> >         }
> >     }
> >     catch (CORBA::COMM_FAILURE& ex)
> >     {
> >         cerr << "Caught system exception COMM_FAILURE -- unable to
> > contact the object" << endl;
> >         return;
> >     }
> >     catch (CORBA::SystemException&)
> >     {
> >         cerr << "Caught a CORBA::SystemException " << endl;
> >         return;
> >     }
> >     catch (CORBA::Exception&)
> >     {
> >         cerr << "Caught CORBA::Exception" << endl;
> >         return;
> >     }
>
> I don't know omniORB, but I think that
> CosNaming::NamingContext::resolve() will raise a NotFound exception if
> the requested object cannot be found (instead of returning a nil
> reference).

thanks sir for the reply. I'll try to do something about it. Any
suggestion?
0
ATAboy
2/15/2008 12:09:29 AM
On Feb 14, 7:09 pm, ATAboy <tipidpc.ata...@gmail.com> wrote:
> On 14 Peb, 22:24, "=C9ric Malenfant" <Eric.Malenf...@gmail.com> wrote:
> > I don't know omniORB, but I think that
> > CosNaming::NamingContext::resolve() will raise a NotFound exception if
> > the requested object cannot be found (instead of returning a nil
> > reference).
>
> thanks sir for the reply. I'll try to do something about it. Any
> suggestion?

Specifically catch()-ing exceptions raised by resolve (NotFound,
CannotProceed, InvalidName), and looking  for more information in the
exception could help you to identify the source of the problem.
0
ISO
2/15/2008 3:27:08 PM
On Feb 15, 11:27 pm, "=C9ric Malenfant" <Eric.Malenf...@gmail.com>
wrote:
> On Feb 14, 7:09 pm, ATAboy <tipidpc.ata...@gmail.com> wrote:
>
> > On 14 Peb, 22:24, "=C9ric Malenfant" <Eric.Malenf...@gmail.com> wrote:
> > > I don't know omniORB, but I think that
> > > CosNaming::NamingContext::resolve() will raise a NotFound exception if=

> > > the requested object cannot be found (instead of returning a nil
> > > reference).
>
> > thanks sir for the reply. I'll try to do something about it. Any
> > suggestion?
>
> Specifically catch()-ing exceptions raised by resolve (NotFound,
> CannotProceed, InvalidName), and looking  for more information in the
> exception could help you to identify the source of the problem.

Thanks sir. I think I'm really having problem with the Naming stuff.
Sometimes, when I run the command "namectl list", the name service
does not appear. Somehow it does not "bind" all the time. Does anyone
have a template or simple program or maybe a pseudocode on how to
implement a client that is also a server.
0
ATAboy
2/18/2008 1:56:12 PM
Reply:

Similar Artilces:

Server to server = Server client to server?
For a server to server connection, is the connecting server considered as a client of the accepting server or is it not? I have the following classes: Connection <--- base class of the following two ClientConnection <--- client ServerConnection <--- server ServerClientConnection <--- server as a client of another server. But then I came across something that states "A client is anything connected to a server that is not another client". Comments please... Just remember! Server ( programm ) is always listening a connections!!! - wrote: &g...

Corba java apllet client communication problemI hava a problem with communication between Java/Corba server based on JDK ORB with Java/Corba client (applet)
I hava a problem with communication between Java/Corba server based on JDK ORB with Java/Corba client (applet) based on the same ORB. I`m using IOR to localize server. client`s ORB i initialize like that: Dane proxy = null; ORB orb = ORB.init(parent, null); org.omg.CORBA.Object obj = orb.string_to_object(sIOR); proxy = DaneHelper.narrow(obj); server`s ORB i initialize like that: ORB orb = ORB.init(args, null); POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); rootpoa.the_POAManager().activate(); DaneImpl oDane = new DaneImpl(); org.omg...

How to return object references for Corba objects from server to client code
Please walk through the scenario below: file: myInterfaces.idl interface Bar { string getMsg(); }; interface Foo { Bar getBar(); }; In the FooImpl.cxx, i have to create a Bar Object and return a reference to it in the getbar() function. i did something as follows: Bar_ptr FooImpl::getBar() { BarImpl* p2Bar = new BarImpl(); return p2Bar; } In the Client.cxx, i did something as follows. int main() { } Sorry, the previous thread is posted abruptly.... The full scenarion is here. Please walk through the scenario below: file: myInterfaces.idl...

[tao-users] Solaris Client and server communication via TAO2.0.3 hangs at method ::CORBA::Object::tao_object_initialize (this) on client side
--90e6ba61384638f76b04b6cbc5ea Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hello, We have a VC++ client/ C++ server application communicating via TAO2.0.3. both developed for Windows and Solaris. On Windows both client and server is working fine and are able to communicate properly with TAO. On Solaris Server is running fine and is able to set its object on TAO Naming service. We are facing problem while running client application on SOLARIS (Solaris 10) system. After getting the server object from Naming Server, it ...

is it possible to return reference to object on another CORBA server
There are two ORBD servers and two applications working on them (first and second application). I need to create third application on seperate ORBD and pass refenence to object from first application to second application using third application. Second application should correcty call methods of that object. Will it work without any modifications to those two external applications ? Yes, you can. If you POA have the user defined object Id policy then you can create the reference in any application. Michal S. wrote: > There are two ORBD servers and two applications work...

Passing "Hello World" String from one Corba Server to another Server
Hello, I am rather new to Corba, and would like to know how to pass a simple "Hello World" string "upstream" from one "Server" to another "Server". I have a corba RoomBooking Client and Server (which are below). I can get client to call the server via a myRoom naming reference via tnameserv - no worries. WHAT I cannot figure out is how to get a number of room booking servers to pass an object (could just be a "Hello World" string) from one server to another server. For example if I had started a client, and two server. 1. Th...

Passing "Hello World" String from one Corba Server to another Server
Hello, I am rather new to Corba, and would like to know how to pass a simple "Hello World" string "upstream" from one "Server" to another "Server". I have a corba RoomBooking Client and Server (which are below). I can get client to call the server via a myRoom naming reference via tnameserv - no worries. WHAT I cannot figure out is how to get a number of room booking servers to pass an object (could just be a "Hello World" string) from one server to another server. For example if I had started a client, and two server. 1. The client ...

Server has disconnected client because client could not keep up with the server. (Web Server and Remote Panel)
How to keep the connection continuously without disconnect from server either in Web Server or Remote Panel? &nbsp; Thank You. &nbsp; Hello, Could you please figure out your problem a little bit more specific. Christian ...

Client to telnet into server and then ftp to another server
Hi I am trying to write a java client that connects to a ftp server. The trick is that the ftp server has a private IP and is sitting behind a Telnet server with a public IP address. How can I go about implementing this client? [I already have the ftp client working.]. The idea is first to connect via telnet, then connect to the ftp server and then download/upload files. Can I use TelnetInputStream or what other sugesstions do you have? Thanks, Marlo Marlo wrote: > Hi > > I am trying to write a java client that connects to a ftp server. > The trick is that the ftp server ha...

CORBA client/server communication
Hi, I am in a design stage of a CORBA client/server logic with multiple server processes, which is required for parallelisation of calculation logic. But I have come across two questiosn which I could not answer, 1) Can a CORBA server initiate a response(message, event) back to client independently? 2) Can a single CORBA client handle multiple CORBA server processes at a time(Does the CORBA interface is strictly one to one)? Could anyone please answer these questions? Thanks in advance. Babhith Infosys, London Hi Babhith, In response to your questions, 1) I...

Trying to create a linked server from an SQL Server to another SQL Server on another machine.
I'm Trying to create a linked server from an SQL Server to another SQL Server on another machine. Can anyone suggest some good reference material or tutorials?? So far I'm only finding examples for a linked server to an ACCESS database. Thanks in Advance! gdev (paul.afamdi.okeke@gmail.com) writes: > I'm Trying to create a linked server from an SQL Server to another SQL > Server on another machine. > > Can anyone suggest some good reference material or tutorials?? So far > I'm only finding examples for a linked server to an ACCESS database. There are plent...

Moving WINS clients to another WINS Server from the SERVER
I am trying to get an older Windows NT Server 4.0 WINS Server off-line and move the Ownership WINS records from one database to a new WINS Server on my Windows 2000 Server. I have 200 clients and do not want to go to each desktop. How can I do this from the Server without having to visit each client so that the Clients will resolve to the Windows 2000 WINS Server and not the Windows NT WINS Server. ...

How to set up an NIS server as a NIS client to another server?
Hi, I have a group of solaris 9 machines. sun1 is the NIS master server on the mydomain.com domain. sun2 through sun4 are the NIS clients of sun1. sun1-4 are on subnet1. I have another solaris box - sun5. I configured sun5 as a seperate NIS master server, but I gave it the same domain (mydomain.com). sun6-8 are the clients of sun5. sun5-8 are on subnet2. So far everything works fine. Now I need to configure sun5-8 as the NIS client of sun1. I did "ypinit -c" on sun5, and added sun1 there. But it does not see any users on sun1. I then tried to setup sun5 as a slave server to sun1, I...

Client-Server ( Client starting server remotely )
I'm writing a client-server app. Client controls Server which in turn configures and controls a bunch of hardware. I want to be able to start the server from my client. Now in C/C++ one could simply run the appropriate command string through a standard "system()" call which is relatively simple. JAVA on the other hand seems to require something like RMI to do it. Basically a use case for what I want to do is something like: Start Client GUI Enter name of data file Client checks bonafides of data file. Client reads and parses data file bui...

Web resources about - Example CORBA server that is also a Client to another server - comp.object.corba

Turing machine examples - Wikipedia, the free encyclopedia
He makes this very clear when he reduces the above table to a single instruction called "b" ( Undecidable p. 120), but his instruction consists ...

7 Examples Of Legal Facebook Cover Photos
... to do this experiment.) We thought it’d also be helpful to highlight what other social media experts and brands are doing. Here are a few examples ...

Taking a Deeper Look at Application Traffic Over the Last 30 Days: 6 Examples
Although there has been a lot of speculation in the last few weeks, the long term impacts of the profile redesign on the Facebook platform have ...

example (@example) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

silk and spinach - development, by example
development, by example (by Kevin Rutherford)

History : What are examples of things that are "common knowledge" about history that historians almost ...
These are just a few things off the top of my head that "everyone knows" and I was taught in many history classes, but historians almost universally ...

Yahoo SearchScan Example - Flickr - Photo Sharing!
Explore Tamar Weinberg's photos on Flickr. Tamar Weinberg has uploaded 4087 photos to Flickr.

FaceStatue examples - Facemasks and Wearable Facemasks - YouTube
Example FaceStatues produced from two portrait photos uploaded to ThatsMyFace.com. Both matte and glossy facemasks are shown, as well as a wearable ...

Housing and homelessness clear examples of a Canberra of two parts
Canberra needs to set aside hopeful complacency and address gaps in our social infrastructure.

Captive-Network Example
Visit the post for more.

Resources last updated: 1/29/2016 3:40:54 PM