Results 1 to 6 of 6

Thread: sth wrong with the client written in Python and Server written in C++

  1. #1
    hardaway is offline Registered User
    Name: hardawayc
    Organization: test
    Project: test
    Join Date
    May 2005
    Posts
    3

    sth wrong with the client written in Python and Server written in C++

    simply to say:
    slice code on server side:
    ---------------------------------------------------
    interface IAddress
    {
    TEnterpriseInfo getEnterpriseInfo(string telno)
    }
    class TEnterpriseInfo
    {
    string name;
    string code;
    }
    ---------------------------------------------------
    client code:
    ---------------------------------------------------
    addrPrx = IAddressPrx.checkedCast(proxy)
    if not addrPrx:
    print args[0] + ": invalid proxy"
    return 1
    print "start..."
    try:
    a = addrPrx.getEnterpriseInfo("111")
    print a.name
    except:
    traceback.print_exc()
    ---------------------------------------------------

    the server side was written by C++ and works well.and someone else wrote a simple client to test the server in C++ ,also works well

    and now i wrote a client in Python,it throws such Exception:
    ================================================
    start...
    Traceback (most recent call last):
    File "testAddr.py", line 27, in run
    a = addrPrx.getEnterpriseInfo("111")
    File "IAddress.ice", line 1460, in getEnterpriseInfo
    UnmarshalOutOfBoundsException: exception ::Ice::UnmarshalOutOfBoundsException
    {
    reason =
    }
    ================================================
    why??who knows..pls help me figure out the problem.thx a lot
    Last edited by hardaway; 05-25-2005 at 07:13 AM.

  2. #2
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    Hi,

    I tried writing a python client and C++ server using your interface definition and had no issues. This was with Ice 2.1.1. Perhaps you could supply a more complete code example that duplicates the problem you are seeing. Also, please indicate the version of Ice and Python you are using as well as the operating system.

    Regards,
    Dwayne

  3. #3
    hardaway is offline Registered User
    Name: hardawayc
    Organization: test
    Project: test
    Join Date
    May 2005
    Posts
    3
    k,now i got the answer,it's my fault~~
    ---------------------------------------
    actuall i defined them in two files,IAddress.ice,IAddressData.ice
    code in IAddress.ice
    *****************************
    #include <IAddressData.ice>
    interface IAddress
    {
    TEnterpriseInfo getEnterpriseInfo(string telno)
    }
    *****************************
    and code in IAddressData.ice
    *****************************
    class TEnterpriseInfo
    {
    string name;
    string code;
    }
    *****************************
    and in the testAddr.py file,i wrote code like this:
    *****************************
    Ice.loadSlice("--all -I../slice -I/Ice/slice ../slice/IAddressData.ice")
    Ice.loadSlice("--all -I../slice -I/Ice/slice ../slice/IAddress.ice")
    *****************************

    --all is the cause,if i remove
    Ice.loadSlice("--all -I../slice -I/Ice/slice ../slice/IAddressData.ice")
    this line,and then the client works well
    and also if i only remove --all ,it works well too


    btw.Ice version:2.1.1,Python Version 2.4 Os:linux

    Dwayne: thx a lot. u guys r so great!!!
    Last edited by hardaway; 05-26-2005 at 01:16 AM.

  4. #4
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    Hi,

    Actually, it was not your fault.

    Quote Originally Posted by hardaway
    Ice.loadSlice("--all -I../slice -I/Ice/slice ../slice/IAddressData.ice")
    Ice.loadSlice("--all -I../slice -I/Ice/slice ../slice/IAddress.ice")
    The fact that this caused an unmarshal exception was a bug in Ice. Although loading both slice files with --all is unnecessary since IAddress.ice includes IAddressData.ice, it should not cause an exception. A fix will be available in the next Ice release.

    Thanks for the report,
    Dwayne

  5. #5
    hardaway is offline Registered User
    Name: hardawayc
    Organization: test
    Project: test
    Join Date
    May 2005
    Posts
    3
    hi dwayne..still the same problem

    now the problem is that i got a application that include two service
    like this:
    i'll simply write the code
    service A: two.ice files
    ------------------------------------
    a.ice:
    ------------------------------------
    #incldue <aData.ice>
    interface atest
    {
    aSeq returnaSeq()
    }
    throws CommonException
    ------------------------------------
    aData.ice:
    ------------------------------------
    #include <common.ice>
    struct aSeq
    {
    ...
    }
    ------------------------------------
    service B : 2 .ice file
    ------------------------------------
    b.ice:
    ------------------------------------
    #incldue <bData.ice>
    interface btest
    {
    bSeq returnbSeq()
    }
    throws CommonException
    ------------------------------------
    bData.ice:
    ------------------------------------
    #include <common.ice>
    struct bSeq
    {
    ...
    }
    ------------------------------------
    common.ice the public file which inclueded both in aData.ice and bData.ice
    ------------------------------------
    exception CommonException
    {

    }
    ------------------------------------
    and now here if i have an application that both includes these two serivce.i mean include a.cie and b.ice
    i write code like this:
    Ice.loadSlice(" -all -I./ a.ice")
    Ice.loadSlice(" -all -I./ b.ice")
    it throws RuntimeError: Slice parsing failed for a.ice
    i thought the problem is that both the two files include common.ice
    can u tell me how to solve this problem?

    best regards
    hardaway

  6. #6
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi,

    There are a number of syntax errors in the sample Slice code you posted. In order for us to help you we would need the exact Slice code you are trying to use. Can you put them in a ZIP file and attach them to a message?

    Thanks,
    - Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help required with Python as client and server
    By bobc in forum Help Center
    Replies: 15
    Last Post: 01-13-2009, 03:38 PM
  2. Replies: 6
    Last Post: 08-15-2007, 02:08 AM
  3. Replies: 2
    Last Post: 06-07-2005, 11:37 PM
  4. Replies: 3
    Last Post: 11-26-2004, 09:35 AM
  5. Wrong IP for client Callback
    By tony_h in forum Help Center
    Replies: 4
    Last Post: 09-30-2004, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •