Synchronous AGSFeatureLayer initialization fails: SDK 10.1.1 <--> AGS 10.1

2944
3
Jump to solution
04-10-2013 07:08 AM
KristofferStenersen
Occasional Contributor
Hi forum,

Our customer just bumped their ArcGIS server from 10.05 to 10.11, and they re-published their MXD to the new server.

I need some details from a feature service, so at some point I fetch the service by initializing a feauture layer, synchronously:

NSError *error = nil;
AGSFeatureLayer *lyr = [[AGSFeatureLayer alloc] initWithURL:url mode:AGSFeatureLayerModeOnDemand credential:[Globals getCredential] error:&error];
if (!lyr.fields) { /* a problem */ }


Now. Of course I have.. a problem.. Looking at the ?f=pjson on the two services, they look the same to me. But in the debugger, the layer just does not seem correct at all:

(lldb) po [lyr encodeToJSON]
$1 = 0x12008bc0 {
    allowGeometryUpdates = 0;
    currentVersion = "9.3";
    drawingInfo =     {
    };
    editable = 0;
    geometryType = "";
    hasAttachments = 0;
    id = 0;
    maxScale = 0;
    minScale = 0;
}


I´m about to try 10-1-1-u1 and cross some fingers, but I submitted this app for review yesterdays so it´s already kind of sad. Attached the json for both new and old feature services. Any ideas what is going on?
0 Kudos
1 Solution

Accepted Solutions
KristofferStenersen
Occasional Contributor
The error was as suspected, that /rest/info?f=json returned an invalid token service url.

The constructor (above) takes an AGSCredential. This object only has a username/password, and needs the token service url. So when runtime asks AGS server for the token URL, bad things happen.

In 10.1, the token service url is somehow fetched from some URL header (afaik, this is not my table, but in 10.0 this could be configured in some config) - so the IT guys had to make ssome DNS/reverse proxy/firewall tuning to make this run.

Its pretty strange though, that the synced constructor of AGSFeatureService did not return an error (is nil in my case) here, but initialized with some funny 9.3-values.

View solution in original post

0 Kudos
3 Replies
KristofferStenersen
Occasional Contributor
Now digging further it seems they have an invalid tokenServicesUrl in /rest/info?f=json. Will fix and retry.
0 Kudos
NimeshJarecha
Esri Regular Contributor
It should just work.

Regards,
Nimesh
0 Kudos
KristofferStenersen
Occasional Contributor
The error was as suspected, that /rest/info?f=json returned an invalid token service url.

The constructor (above) takes an AGSCredential. This object only has a username/password, and needs the token service url. So when runtime asks AGS server for the token URL, bad things happen.

In 10.1, the token service url is somehow fetched from some URL header (afaik, this is not my table, but in 10.0 this could be configured in some config) - so the IT guys had to make ssome DNS/reverse proxy/firewall tuning to make this run.

Its pretty strange though, that the synced constructor of AGSFeatureService did not return an error (is nil in my case) here, but initialized with some funny 9.3-values.
0 Kudos