Home Help Center

PublishedEndpoints and IceGrid

albertodsalbertods Member Alberto Della SantinaOrganization: University of Pisa - department of IT EngineeringProject: Mobile remote controller ✭✭
Hi Benoit,
I now have to deploy the midlet into a real phone.

Before using IceGrid, in my simple bidir example, I found out that I needed to set up the PublishedEndpoints property into the config file.

Now that I use IceGrid, how can I set the PublishedEndpoints in the application.xml file (and/or in the config.grid) ?


This is the previous config file (before using IceGrid):
Code:
#SERVER CONFIGURATION 
Callback.Server.Endpoints=tcp -h LOCAL_IP_ADDRESS -p 15000 
Callback.Server.PublishedEndpoints=tcp -h PUBLIC_IP_ADDRESS -p 15000

This is the config file (with IceGrid):


Do I have to put the GLOBAL_IP_ADDRESS in the config.grid file, concerning the Ice.Default.Locator ?

This is the application.xml file:
<icegrid>

 
  <application name="Callback">
     <node name="localhost">
       <server id="Callback.Server" exe="server" activation="on-demand">
     <adapter name="Callback.Server" endpoints="tcp -h 192.168.1.220 -p 15000" register-process="true">
     <object identity="callback" type="myCallBack"/>
  </adapter>
  </server>
  </node>
</application> 
  

</icegrid>



In my example, I have the Locator and the server application that are in the same host, but with different ports: I would like the first binded to the 12000 and the second binded to the 15000.



Thanks a lot in advance


Regards


Alberto

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Alberto,

    <adapter>.PublishedEndpoints tells the ObjectAdapter the endpoints it "publishes". For direct-adapters, this means the endpoints in the proxies you create with this adapter (with any of the operation on the adapter that returns a proxy). For indirect adapters, this means the endpoints the adapter registers with IceGrid during activate().

    If you configure your adapter with "tcp -h 192.168.1.220 -p 12000" for Endpoints and "tcp -h 192.168.1.220 -p 15000" for PublishedEndpoints, you also need some piece of software (typically firewall) that redirects requests to port 15000 to port 12000. Ice is not involved in this port redirection.

    Likewise, if you have 2 network cards in your server, you can't just configure the adapter's Endpoints to be "tcp -h 192.168.1.220 -p 12000" and the PublishedEndpoints to be "tcp -h 1.2.4.5 -p 15000", unless you have another piece of software that takes care of the redirection.

    I hope this is clearer now!

    Bernard
  • albertodsalbertods Member Alberto Della SantinaOrganization: University of Pisa - department of IT EngineeringProject: Mobile remote controller ✭✭
    Thank you Bernard, you have been very kind! I appreciated a lot your reply.

    My intention is to set the PublishedEndpoints with the global ip of my router and for Endpoints the local ip of the server.

    Due to the fact that the Locator is installed in the the same PC where the server.exe is hosted, I tlought as a reasonable choice to set the same Endpoint for both, but with different ports.

    My question is: can I set the PublishedEndpoints in the application.xml (in the case I need it)?
    Should I have to set both the Endpoints and the PublishedEndpoints for the Locator as well?


    Thank you again

    Cheers


    Alberto
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,
    albertods wrote:
    My question is: can I set the PublishedEndpoints in the application.xml (in the case I need it)?
    Should I have to set both the Endpoints and the PublishedEndpoints for the Locator as well?

    Yes, you can set any property in a server descriptor with the <property> XML element.

    Setting the published endpoints of the IceGrid registry client endpoints might be necessary if you want to access the IceGrid registry well known objects (IceGrid::Query, IceGrid::Registry, sessions) through the published endpoints.

    Cheers,
    Benoit.
  • albertodsalbertods Member Alberto Della SantinaOrganization: University of Pisa - department of IT EngineeringProject: Mobile remote controller ✭✭
    Thanks Benoit.

    I receive a WSAECONNREFUSED when a deploy the application described in the file application.xml (using the command icegridadmin --Ice.Config=config.grid -e "application add 'application.xml'").

    I tried to change several settings, but I get this error anyway.

    Could you please help me? This is the last step of my thesis....and I'm going to present it.

    Consider that my laptop has a local address which is 192.168.1.220, and my router has an address which is 87.29.100.50.
    The router is properly configure to manages all the requests that ask for the port 12000 and 15000.
    My laptop hosts both the locator (binded to the port 12000) and the application (port 15000).


    This is the config.grid file:
    IceGrid.InstanceName=DemoIceGrid
    
    #
    # The IceGrid locator proxy.
    #
    Ice.Default.Locator=DemoIceGrid/Locator:tcp -h 87.29.100.50 -p 12000
    
    #
    # IceGrid registry configuration.
    #
    IceGrid.Registry.Client.Endpoints=default -p 12000
    IceGrid.Registry.Server.Endpoints=default
    IceGrid.Registry.Server.PublishedEndpoints=tcp -h 87.29.100.50 -p 12000
    IceGrid.Registry.Internal.Endpoints=default
    #IceGrid.Registry.Internal.PublishedEndpoints=tcp -h 87.29.100.50 -p 12000
    IceGrid.Registry.Admin.Endpoints=default
    #IceGrid.Registry.Admin.PublishedEndpoints=tcp -h 87.29.100.50 -p 12000
    IceGrid.Registry.Data=db/registry
    
    #
    # IceGrid node configuration.
    #
    IceGrid.Node.Name=localhost
    IceGrid.Node.Endpoints=tcp -h 192.168.1.220 -p 15000
    IceGrid.Node.PublishedEndpoints=tcp -h 87.29.100.50 -p 15000
    IceGrid.Node.Data=db/node
    IceGrid.Node.CollocateRegistry=1
    #IceGrid.Node.Output=db
    #IceGrid.Node.RedirectErrToOut=1
    
    #
    # Trace properties.
    #
    IceGrid.Node.Trace.Activator=1
    IceGrid.Node.Trace.Patch=1
    #IceGrid.Node.Trace.Adapter=2
    #IceGrid.Node.Trace.Server=3
    


    and this is the application.xml file:
    <icegrid>
    
     
      <application name="Callback">
         <node name="localhost">
           <server id="Callback.Server" exe="server" activation="on-demand">
         <adapter name="Callback.Server" endpoints="tcp -h 192.168.1.220 -p 15000" register-process="true">
         <adapter name="Callback.Server" PublishedEndpoints="tcp -h 87.29.100.50 -p 15000" register-process="true">
         <property name="Identity" value="callback"/>
         <object identity="callback" type="myCallBack"/>
      </adapter>
      </server>
      </node>
    </application> 
      
    
    </icegrid>
    
    
    

    What might be wrong?


    Thank you in advance!


    I would really appreciate any help from you.



    Alberto
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    One problem is that you did not set the PublishedEndpoints using a property xml element as Benoit suggested, You have:
    <adapter name="Callback.Server" PublishedEndpoints="tcp -h 87.29.100.50 -p 15000" register-process="true">
    

    Instead you should have:
    <property name="Callback.Server.PublishedEndpoints" value="tcp -h 87.29.100.50 -p 15000">
    

    Also, to help you diagnose your problem you should turn on network tracing with Ice.Trace.Network=2 so you can see what addresses are being used where.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Btw, which Ice version do you use? I don't understand how you were able to deploy this application descriptor. The IceGrid XML parser should have rejected your application.xml descriptor because of the invalid "PublishedEndoints" attribute in the <adapter> element. Here's what I get if I try to deploy your descriptor:
    error: DescriptorParser.cpp:771: IceXML::ParserException
    error in <application.xml> descriptor, line 10, column 5:
    unknown attributes in <application.xml> descriptor, line 10:
    PublishedEndpoints
    

    Cheers,
    Benoit.
  • albertodsalbertods Member Alberto Della SantinaOrganization: University of Pisa - department of IT EngineeringProject: Mobile remote controller ✭✭
    Thanks a lot! Now it works!

    I was uncertain whether to put the PublishedEndpoints as an attributes of the adapter element or not.... in this case I get the error that Benoit shows.

    I didn't realize that I had to put it as a true XML element :) thank you again!


    I use Ice 3.0.1. :o:o I know that I should update it, but consider that I've been learning ICE for my thesis since last March and I don't feel like updating my developing environment :o

    Today is my last day of apprenticeship in the company that is written in my signature....On monday I will change it (and it will become University of Pisa - Italy) :)



    I've noticed that when there is a sintax error in the application.xml file, if there is a WSAECONNREFUSED when I deploy the application, this xml-error is not shown.



    I would like to thank you all! You have really helped me in the develop of this application! It will be an honor for me to quote all of you in my dissertation!


    Thanks a lot!




    With my very best regards



    Alberto
  • albertodsalbertods Member Alberto Della SantinaOrganization: University of Pisa - department of IT EngineeringProject: Mobile remote controller ✭✭
    icegridnode error: cannot convert 'server' into an absolute path

    Dear all,
    I've changed the public IP address of the server, which is configured in the application.xml file, with my dynamyc DNS (it's something like XXXXX.dyndns.org).



    <icegrid>
    
     
      <application name="Callback">
         <node name="localhost">
           <server id="Callback.Server" exe="server" activation="on-demand">
         <adapter name="Callback.Server" endpoints="tcp -h 192.168.1.220 -p 15000" register-process="true">
         <adapter name="Callback.Server" PublishedEndpoints="tcp -h XXXXX.dyndns.org -p 15000" register-process="true">
         <property name="Identity" value="callback"/>
         <object identity="callback" type="myCallBack"/>
      </adapter>
      </server>
      </node>
    </application> 
      
    
    </icegrid>
    


    I know for sure that this dynamic DNS address works correctly.


    Well, the problem occurs when I call the server from my mobile: I get this error
    icegridnode error: cannot convert 'server' into an absolute path
    

    Can I use this kind of addressing? Where else do I have to put it?
    I left unmodified the config.grid file: do I have to modify also this?


    Thanks in advance


    Regards


    Alberto
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    This error is unrelated to endpoints. Icegridnode just tells you that it can't locate your executable:

    <server id="Callback.Server" exe="server" activation="on-demand">

    I'd recommend to specify a full path for your exe.

    Cheers,
    Bernard
  • albertodsalbertods Member Alberto Della SantinaOrganization: University of Pisa - department of IT EngineeringProject: Mobile remote controller ✭✭
    Thanks a lot! :)
Sign In or Register to comment.