Archived

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

Invalid proxy

Hi,

I am a newbie to ICE but i am very fascinated by your technology and i want to learn more. I am using ICE for a very important project at my company. The server objects are built with C++ and reside on a remote machine in a different campus from where my client (C#) is located. I can telnet to the machine without any issues. but when i try to connect with my client by passing in the IP address and the port in my proxy, i get Invalid proxy message. I also tried paying with the session demo by running the session server on the actual server and tried communicating to it by executing the client on my machine and i get the similar message. I also changed the config.client file by including the IP/hpst address with -h. And i also understand that "invalid proxy" is an exception trhown by the client. But what i an confused is with is why i can connect via telnet and not with my client. I am not a network guy, so i appreciate any help here.

Regards and thank you in advance for your help,
Kalyan

Comments

  • mes
    mes California
    Welcome to the forum.

    In order to help you, we need to know more details about your problem. For example, please provide the exact exception or error message you are receiving. It would also be helpful for us to see the proxy string that your client is attempting to use. Finally, please tell us which version of Ice and which operating system(s) you are using.

    Take care,
    Mark
  • Same here.

    Hi,

    I'm facing the same problem.

    The code I'm using is copied verbatim from the tutorial.
    Log.Write(LogLevel.Debug, "Creating Proxy");
    Ice.ObjectPrx obj = ic.stringToProxy(stringToProxy);
    ServiceProxy = CCMServicePrxHelper.checkedCast(obj);
    if (null == ServiceProxy)
        throw new ApplicationException("Invalid Proxy");
    

    The value of stringToProxy is "MyServiceName:tcp -h my.hostname -p 10000"

    The service MyService is up and running, and I'm able to telnet to port 10000 on my.hostname .

    When I run this code, it throws ApplicationException("Invalid Proxy")

    I tried debugging through it, and even downloaded your source code, but couldn't quite figure out why checkedCast(obj) is returning null.

    Ice 3.4.1 on Windows XP, C#/.NET 4.0 on VS2010
  • I managed to get this to work:
    ServiceProxy = CCMServicePrxHelper.uncheckedCast(obj);
    

    The methods are being called and values are being returned as expected.

    What would cause checkedCast to return null, but uncheckedCast to succeed, and what should I look for?
  • bernard
    bernard Jupiter, FL
    Hi Shashvat,

    Welcome to our forums!

    Both checkedCast and uncheckedCast manufacture a proxy of the desired type; uncheckedCast does this locally only, while checkedCast sends a request to the target object to verify it does indeed implement the desired interface (the operation is ice_isA).

    checkedCast returns null when the target object does not implement the desired interface; the check is performed by comparing Ice type-ids.

    If your application works fine with uncheckedCast, and a switch to checkedCast breaks it (because checkedCast returns null), you should double-check your client and server are using the same Slice definitions--a renamed module in the client or server would trigger this kind of error. Another possibility is that you're using Dynamic Ice on the server side and didn't implement ice_isA properly in the target Blobject.

    Now, if you don't know or are not sure about the interfaces implemented by the target object, you can use the ice_id or ice_ids operation to find out. See http://www.zeroc.com/doc/Ice-3.4.1-IceTouch/manual/Slice.5.14.html.

    Best regards,
    Bernard