Page 1 of 1

Web Service - Version Mismatch No Exception Thrown In Client

Posted: Sun Sep 25, 2011 7:54 am
by RobOrt
Hi,

I've been working on improving the error handling in my AndroidPhidgets code. In particular I've been testing for version mismatch between client and webservice version, my client running version 2.1.7 of the Phidget library and the WebService running 2.1.8.

When running the Webservice in debug mode it correctly reports the version mismatch and rejected connection attempts but in my client code there is no exception thrown or error given.

I should also point out that this occurs when opening a remote Phidget Manager and I notice from the documentation that Manager is not descended from Phidget class but from Java Object. Consequently I cannot attach an Error Listener to my Manager object and nothing is thrown to the catch block surrounding Manager.open() line:

Code: Select all

try{
            m.open(ip, port);
            Message msg = Message.obtain(guiHandler);
            msg.obj = "Connecting to " + ip + ":" + port;
            msg.arg1 = AndroidPhidget.DISPLAYMESSAGE;
            msg.sendToTarget();
         } catch (PhidgetException e) {
            Message msg = Message.obtain(guiHandler);
            msg.obj = e.toString();
            msg.arg1 = AndroidPhidget.DISPLAYMESSAGE;
            msg.sendToTarget();
         }


Does Manager not report/throw exception should Webservice version mismatch occur? (Note this is library version 2.1.7)

Re: Web Service - Version Mismatch No Exception Thrown In Cl

Posted: Mon Sep 26, 2011 12:43 pm
by Patrick
The manager does support error handlers - but for some reason, this functionality isn't brought out to Java. I'll put this on the fix-list.

-Patrick

Re: Web Service - Version Mismatch No Exception Thrown In Cl

Posted: Tue Sep 27, 2011 7:54 am
by RobOrt
Hi Patrick,

I assume that the Dictionary object doesn't include Error handling either as it's not descendent from Phidget object so would be handy to give Dictionary this functionality too.

I've managed to come up with a 'work-around' that will report all thrown errors to my own descendent of the Manager object. Basically, within my own Manager descendent I create a fictitious Phidget device e.g. Interface Kit and attach an ErrorListener to it (which happens to be a method of my own Manager descendent). to open the Interface Kit I chose a serial number at random e.g. 2 but just to be on the safe side, are there any serial numbers that are/will be unavailable in devices on the market?

I don't even have to open an InterfaceKit as it can be any descendent of Phidget but I just wanted to be sure I'm using a device serial number that will not be available.

Thanks

Re: Web Service - Version Mismatch No Exception Thrown In Cl

Posted: Tue Sep 27, 2011 9:39 am
by Patrick
Ok, I will add it to the dictionary also. 2 should be safe. You could also use 0, as there has never been a Phidget with that serial.

-Patrick

Re: Web Service - Version Mismatch No Exception Thrown In Cl

Posted: Wed Sep 28, 2011 3:36 pm
by RobOrt
Many thanks Patrick.