Archived

This forum has been archived. Please start a new discussion on GitHub.

send an object client -> server

Hi everybody,

I am Arnaud and new on this forum.

I have to do a project using Ice. I have one client and one server (both in Java)
The client has to send an object (which has previously been created by the client) to the server.

I made some programms. I think what I did is not very good.

I never used Ice before. I am a newbee in middleware.

Could you tell me if what I did is correct? Could you give me some clues to improve it ?

I thank you very much

I join the sources of my programms

Comments

  • matthew
    matthew NL, Canada
    I'm sorry, but unless you have specific questions about Ice its very hard to help you.
  • xdm
    xdm La Coruña, Spain
    Hi arnaud
    I have to do a project using Ice. I have one client and one server (both in Java)
    The client has to send an object (which has previously been created by the client) to the server.

    if you want to send a class using Ice, this class must be defined previous in slice. and you need and slice method that accep this clas by value.
     module A
     {
                 class MyClass
                 {
                          int a;
                          long b;
                          String c;
                 };
    
                interface test
                {
                           void sendClass(MyClass c);
                };
     };
    
    your servant must use the slice defined method to receive the class by value
        void sendClass(MyClass c,Ice.Current current)
       {
                    //here procces the class that received from client
       }
    
    And your client must create the class and send it using the slice method that accept it as a param

    note that MyClassI is your java implementation for MyClass defined type and testPx is a proxy to the test interface register in your server
                MyClass c=new MyClassI(1,2,3);
                testPx.sendClass(c);
    

    if you want send class from server to client, you must read about ObjectFactories in Ice book
  • Thank you very much !!

    :)