[CORBA, Visibroker, C++] Array, sequence problem.

Discussion in 'C++' started by Krzysztof Opa³a, Aug 28, 2004.

  1. Hi
    I've got my CORBA application written in Borland C++ Builder, using
    Visibroker. What I wanna do is get from server a set of strings (the number
    of string is not constant). I was trying to do it with sequence but got some
    problems. Here is the method i IDL:

    long get_clerks_list (out workerseq loginnames);

    where long is number of strings in loginnames
    and
    typedef sequence<long> workerseq;

    Could anybody give me a simple example how to write a server function
    (puting 'aaa', 'bbb', 'ccc' and returning it), and how to use it by client.
    I'll compare it to my code and find out what's wrong.

    Thanks in advance
    Chris
     
    Krzysztof Opa³a, Aug 28, 2004
    #1
    1. Advertising

  2. "Krzysztof Opa³a" <> wrote in message news:<cgq66i$mtn$>...
    > I've got my CORBA application written in Borland C++ Builder, using
    > Visibroker. What I wanna do is get from server a set of strings (the number
    > of string is not constant). I was trying to do it with sequence but got some
    > problems. Here is the method i IDL:
    >
    > long get_clerks_list (out workerseq loginnames);
    >
    > where long is number of strings in loginnames
    > and
    > typedef sequence<long> workerseq;
    >
    > Could anybody give me a simple example how to write a server function
    > (puting 'aaa', 'bbb', 'ccc' and returning it), and how to use it by client.
    > I'll compare it to my code and find out what's wrong.


    I assume workerseq is a sequence of string, not a sequence of long.

    CORBA::Long
    YourServantClass::get_clerks_list(workerseq_out loginnames)
    throw(CORBA::SystemException) {
    workerseq_var ws = new workerseq(3);
    ws->length(3);
    ws[0] = CORBA::string_dup("aaa");
    ws[1] = CORBA::string_dup("bbb");
    ws[2] = CORBA::string_dup("ccc");
    loginnames = ws._retn();
    return loginnames->length();
    }

    Assuming the client already has an object reference to your object, it
    does something like this:

    workerseq_var ws;
    CORBA::Long len = objref->get_clerks_list(ws.out());
    cout << "first entry is " << ws[0] << endl;

    See "Advanced CORBA Programming with C++" for more details
    (http://www.iona.com/hyplan/vinoski/).

    --steve
     
    Steve Vinoski, Aug 28, 2004
    #2
    1. Advertising

  3. "Steve Vinoski" <> wrote in message
    news:...
    > "Krzysztof Opa³a" <> wrote in message

    news:<cgq66i$mtn$>...
    > > I've got my CORBA application written in Borland C++ Builder, using
    > > Visibroker. What I wanna do is get from server a set of strings (the

    number
    > > of string is not constant). I was trying to do it with sequence but got

    some
    > > problems. Here is the method i IDL:
    > >
    > > long get_clerks_list (out workerseq loginnames);
    > >
    > > where long is number of strings in loginnames
    > > and
    > > typedef sequence<long> workerseq;
    > >
    > > Could anybody give me a simple example how to write a server function
    > > (puting 'aaa', 'bbb', 'ccc' and returning it), and how to use it by

    client.
    > > I'll compare it to my code and find out what's wrong.

    >
    > I assume workerseq is a sequence of string, not a sequence of long.
    >
    > CORBA::Long
    > YourServantClass::get_clerks_list(workerseq_out loginnames)
    > throw(CORBA::SystemException) {
    > workerseq_var ws = new workerseq(3);
    > ws->length(3);
    > ws[0] = CORBA::string_dup("aaa");
    > ws[1] = CORBA::string_dup("bbb");
    > ws[2] = CORBA::string_dup("ccc");
    > loginnames = ws._retn();
    > return loginnames->length();
    > }
    >
    > Assuming the client already has an object reference to your object, it
    > does something like this:
    >
    > workerseq_var ws;
    > CORBA::Long len = objref->get_clerks_list(ws.out());
    > cout << "first entry is " << ws[0] << endl;
    >
    > See "Advanced CORBA Programming with C++" for more details
    > (http://www.iona.com/hyplan/vinoski/).
    >
    > --steve


    Thanks a lot for your answer. It's going to be better but I still got one
    big problem. While calling my method from client - the client throw
    "External exception EEFFACE". What is strange - I call other methods from
    the same interface and they're doing well. Have you got any idea ?

    BTW: Of course workerseq is a sequence of string :)

    Regards
    Chris
     
    Krzysztof Opala, Aug 29, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Donnie Fuqua

    perl and corba?

    Donnie Fuqua, Jan 17, 2005, in forum: Perl
    Replies:
    0
    Views:
    530
    Donnie Fuqua
    Jan 17, 2005
  2. Replies:
    0
    Views:
    399
  3. Stefan Seefeld
    Replies:
    3
    Views:
    964
  4. Tomek
    Replies:
    1
    Views:
    1,027
    Jack Klein
    Jun 1, 2006
  5. stef mientki
    Replies:
    13
    Views:
    646
    stef mientki
    Oct 20, 2007
Loading...

Share This Page