how to test problems with query task using dynamic proxy

3218
5
09-02-2010 07:55 AM
SebastianRoberts
Occasional Contributor III
I have set up a secured service and am accessing it with the search/select tool.  I set up a dynamic proxy, and set the querytask.proxyURL property = http://gisWEBServer/proxy.ashx.  This is working for some of my queries, but for others I get an "RPC fault" or "0 features selected".  If I try the same query through the rest API, it works, and if I move the map service to the public side and comment out the line in my Flex app that sets the queryTask.proxyURL, the query works as well.

How can I either
a) test the REST API with the query running through the proxy, or
b) debug the Flex application to get more info than just the "RPC fault" error message


For A), I tried to run to test the REST API using the proxy with the following URL:
http://gisWEBServer/proxy.ashx?http://gisDataserver/ArcGIS/rest/services/internal/parcels/MapServer/...
However, I get a "Runtime Error  Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons)."
Tags (2)
0 Kudos
5 Replies
DasaPaddock
Esri Regular Contributor
For B, there isn't a better option since Flash Player doesn't pass on the body of the HTTP response if the response code is not 200.
0 Kudos
SebastianRoberts
Occasional Contributor III
I am still having issues with this.  If I put the service in my public folder on our GIS server everything works fine.  If I move the service into the secured folder on the GIS server using a dynamic proxy, most of the queries work fine  unless I put a wildcard in the where clause (but only at the beginning).

So, unsecured all queries below work.
Secured,
This works:             queryTask.where = APN LIKE '0840604%'
This doesn't work:    queryTask.where = APN LIKE '%0840604%'

Why would adding the wild card at the beginning of the string make it fail?
The error I get is
[RPC fault faultstring=""
faultCode = "400"
faultDetail = "Unable to perform query.  Please check your parameters."}

If I try the exact same queries through the REST API on the secured service they also work fine.  It seems that somehow the dynamic proxy doesn't like the wildcard.

Thanks for any insight,
Sebastian Roberts
0 Kudos
DasaPaddock
Esri Regular Contributor
Can you try downloading the ASP.NET proxy again at:
http://help.arcgis.com/en/webapi/flex/help/index.html#proxy.htm

It has some fixes in this area that may resolve this issue.
0 Kudos
SebastianRoberts
Occasional Contributor III
Unfortunately, I am not using the out of the box token page because it does not support dynamic tokens.  I am using the dynamic token proxy page posted by Thang Le of ESRI in this forum.  I am using his modified version, and don't think I have expertise to combine with the file you recommend.

I do think the wildcard causes the query to fail because the percent sign is used as a wildcard, but also is used in the query string (see below) perhaps an escape character.  Is there some way to change the proxy.ashx file so that the query string is parsed correctly when a wildcard is used at the beginning of the where clause?

The two queries are identical except for the where clause.

This query fails using:       where APN LIKE '%0840604%'

http://<webserverName>/proxy.ashx?http://<ArcGISserverName>/ArcGIS/rest/services/internal/parcel_owner_mail_situs_sdevw_test/MapServer/0/query?where=APN%20LIKE%20%27%250840604%25%27&f=json&returnGeometry=false&outFields=APN



This query works using:       where APN LIKE '0840604%'

http://<webserverName>/proxy.ashx?http://<ArcGISserverName>/ArcGIS/rest/services/internal/parcel_owner_mail_situs_sdevw_test/MapServer/0/query?where=APN%20LIKE%20%270840604%25%27&f=json&returnGeometry=false&outFields=APN

Thanks,
Sebastian Roberts
0 Kudos
SebastianRoberts
Occasional Contributor III
The problem is solved with the help of ESRI technical support.  The string was not being parsed correctly.  In the proxy.ashx file, in the ProcessRequest function, the following line:
string uri = Uri.UnescapeDataString(context.Request.QueryString.ToString());

must be changed to:
string uri = context.Request.Url.Query.Substring(1);

As Dasa mentioned, this has already been fixed in the new asp.NET proxy with the link  provided in Dasa's last post, but as far as I can tell this doesn't work with a dynamic proxy, so if you use the dynamic proxy created by Thang Le mentioned in my last post, you would need to make this change if using wildcards in your where clause.

Sebastian Roberts
0 Kudos