Select to view content in your preferred language

querytask proxy using actionscript

1655
6
Jump to solution
09-02-2014 06:20 PM
LefterisKoumis
Regular Contributor II

Hello.

I have to use proxy for the querytask in the actionscript (not in the xml widget config).  What is equivalent to <useproxy>true</useproxy> to actionscript?

Is there a property that I can use with the query? I couldn'r find one. Thanks.

var queryBuffer:Query = new Query();

  queryBuffer.spatialRelationship = querySpatialRel;

  queryBuffer.geometry = geom;

  queryBuffer.returnGeometry = true;

  queryBufferTask.url=layerConfig.url;

  queryBuffer.outSpatialReference = map.spatialReference;

  queryBuffer.outFields = layerConfig.outfields;

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Lefteris,

   It seems that there is an UNDOCUMENTED property of proxyURL on the QueryTask. So just use proxyURL on your QueryTask

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

Lefteris,

   The QueryTask and Query does not have a proxyURL property or anything that you can set. You have to manually add the proxy url to the map service url like this:

myQueryTask.url = "http://gislap183/Poxy/proxy.ashx?http://sampleserver1.arcgisonline.com/ArcGIS/res...

Or use a FeatureLayer instead and it has a proxyURL property.

0 Kudos
LefterisKoumis
Regular Contributor II

Thank you for the reply, Robert. I followed the suggestion and now I get the error:

Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.

Do I need to use escape characters for the slashes?

My url was:

queryBufferTask.url= "http://xxx.xxx.xx.xxx/DotNetProxy/proxy.ashx?https://xxx.xxx.xxx.xxx/arcgis/rest/services/Project_PA...";

Thanks.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Lefteris,

   It seems that there is an UNDOCUMENTED property of proxyURL on the QueryTask. So just use proxyURL on your QueryTask

0 Kudos
LefterisKoumis
Regular Contributor II

Thank you Robert. I can't believe how did I miss the proxyURL since I was checking each property.

Using queryBufferTask.proxyURL= "http://xxx.xxx.xx.xxx/DotNetProxy/proxy.ashx?https://xxx.xxx.xxx.xxx/arcgis/rest/services/Project_PA...";

would draw the same error #2101.

However, using the url and the proxyURL, it works.

queryBufferTask.url="https://xxx.xxx.xxx.xxx/arcgis/rest/services/Project_PAD/PAD/FeatureServer/0"

queryBufferTask.proxyURL = "http://xxx.xxx.xxx.xxxx/DotNetProxy/proxy.ashx?";

0 Kudos
BjornSvensson
Esri Regular Contributor

I'm glad the problem got solved. 

Just a quick note that the proxyURL is a property of BaseTask, which QueryTask inherits from. It's listed in the documentation at https://developers.arcgis.com/flex/api-reference/com/esri/ags/tasks/QueryTask.html#propertySummary.  Make sure to "Show Inherited Public Properties".

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I should have known that. Thanks for the clarification Bjorn.

0 Kudos