Select to view content in your preferred language

problems executing a query task against a secure service

499
0
05-18-2011 10:13 AM
TracySchloss
Honored Contributor
I have been using a set of functions to run query tasks for a long time.  I now need to run the same query tasks against a secure service.  I thought it would be a matter of adding the token parameters to the querytask, something like:

var coQryTask:QueryTask = new QueryTask ();
var tokenString:String = "szd;flksdjfaweporjiwerpoiwjer";
coQryTask.url="http:myserver/arcgis/rest/services/SecureServices/mySecureLayer/MapServer/0;
coQryTask.token = tokenString;   
coQryTask.showBusyCursor = true;
coQuery.geometry = mainMap.extent;
coQryTask.execute(coQuery, new AsyncResponder( coResult, onFault ));

coQuery is defined elsewhere as:
<esri:Query id="coQuery" where="1=1" returnGeometry="true"
   outFields="[  'NAME', 'RATE' , 'INCIDENTS' , 'POPULATION'  ]"
   outSpatialReference="{mainMap.spatialReference}" />

My result function does not return anything in the feature set:

public function coResult( qryFeatureSet:FeatureSet, token:Object = null ) : void  
            for each (var myGraphic:Graphic in qryFeatureSet.features)  {
          
       myGraphic.toolTip = myGraphic.attributes.NAME2 + "\n"
      + "Total Population: " + myGraphic.attributes.POPULATION + "\n"
      + "Incidents: " + myGraphic.attributes.INCIDENTS + "\n"
      + "Rate: " + myGraphic.attributes.RATE + "\n";
      
coGraphicsLayer.add( myGraphic );     
     }
      } 

I've been assuming the token:Object = null part of the function is something that goes with an asynchronous request and is NOT the token string that I was issued by the token service. 

This code has worked just fine for me against a standard service, I just can't get it to work with the secure service.  If I hard code everything with my querytask and query it does run, but I need to get this to work in ActionScript.
Tags (2)
0 Kudos
0 Replies