Nliu's TOC and Legend issue - hits tools at times

Discussion created by amarsden on Jan 30, 2015

Ok - I'm not sure if this more an issue with our setup rather than the code, as it is random. But sometime the creation of a TOC hangs - eventually I get a timeout error.

I tracked this down and occasionally it seems to be hitting to get the legend - of course, with an internal URL it falls over.


I have hacked the code to prevent this

            //ACM hack
            //if (this.rootLayer.version >= 10.01) {
            if (1==1) {
                url = this.rootLayer.url + '/legend';
            } else {
                url = '';
                var i = this.rootLayer.url.toLowerCase().indexOf('/rest/');
                var soap = this.rootLayer.url.substring(0, i) + this.rootLayer.url.substring(i + 5);
                url = url + '?soapUrl=' + escape(soap);


As I know my services are greater than 10.01 I can always do this section and rather than remove the 'if' totally I replaced the condition with 1==1


I also put a





in the code - the times it fails this returns as empty





always returns a value, even when version is empty - other properties of this.rootlayer are also fine.


I have no idea why it is happening, but this is my fix I thought I'd share.