Select to view content in your preferred language

Proxy help?

827
6
01-07-2011 09:48 AM
MatthewLawton
Deactivated User
I am attempting to get the KML widget (created by Luke Berndt) working in my SFV 1.3. I think the problem I am having is that the KML file I am attempting to add is hosted on the web at a server location that uses an IP address. I currently get the following error when I try to point to this KML file in my config file:

Error #2044: Unhandled SecurityErrorEvent:. text=Error #2048: Security sandbox violation: http://wcgisweb2.admin.washoecounty.us/Emergency_src/bin-debug/com/esri/solutions/flexviewer/widgets/KMLWidget.swf cannot load data from http://66.134.213.74/WildEarth/WildCAD_NVSFC.kml.


It is my limited understanding that Flex doesn't like SWFs that point to external data that is hosted outside of the local domain. I have read that in order to get around this, it is necessary to create a proxy file in ASP.Net, PHP, etc.

I have some questions about the proxy process...

1. Given my description above, is this the likely problem I am encountering?
2. Is there a brief and coherent description available of the proxy process and what it is actually doing?
3. Is there a brief and coherent set of instructions available for implementing the proxy solution (preferably in PHP)?
4. Is there another method of solving this issue without having to turn to ASP.Net, PHP, etc.?
Tags (2)
0 Kudos
6 Replies
DasaPaddock
Esri Regular Contributor
The easiest solution may be to put a crossdomain.xml file at http://66.134.213.74/crossdomain.xml if you have access to that. If not, than using a proxy is really the only other solution since Flash will give you this security error if the domains are not the same and the other domain does not have a crossdomain.xml file granting access to your swf's domain.

Here is some proxy information along with a few different implementations:
http://help.arcgis.com/en/webapi/flex/help/content/proxy.htm
0 Kudos
MatthewLawton
Deactivated User
I do not have access to  http://66.134.213.74/. It is somebody else's server that I have no control over, so I guess we have to work through the proxy page implementation. Okay, let's go through it step-by-step, here are the problems I am encountering.

1. I have copied the "proxy.php" file to my server. I am running PHP and I put the file a directory that runs PHP files. Do I need to install any additional extensions to PHP to get this to work? (Please keep in mind I am very much a novice when it comes to PHP)
2. Where do I point the source parameter in the KMLWidget.xml? Do I point it to the PHP file?
3. I am unclear exactly what to edit in the proxy.php to point it to the right location. The documentation makes it sound like every external request is going to get routed to this other server(http://66.134.213.74/). I only want the requests from the KMLWidget to get routed to the other server. How do I make that happen without screwing up my other widgets?

Thank you for helping me through this, Dasa.
0 Kudos
DasaPaddock
Esri Regular Contributor
1. You need to have the curl extension installed. See the instructions under the REQUIREMENTS section of proxy.php.

2. Yes, you'd need to have it go to the proxy. The general format is: [proxy url]?[resource url]
Try: "proxy.php?http://66.134.213.74/WildEarth/WildCAD_NVSFC.kml"

3. In the proxy.php file, you need to allow it to load resources from http://66.134.213.74/ since it doesn't allow proxying to anywhere be default. Add an entry to the serverUrls array like this:
    array( 'url' => 'http://66.134.213.74/',        'matchAll' => true, 'token' => '' )
0 Kudos
MatthewLawton
Deactivated User
I setup cURL (I think). It shows up in my PHPinfo.php file as enabled.

I made the appropriate adjustments to the KMLWidget.ini and the proxy.php file, but I am getting this error:

Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
 at com.esri.solutions.flexviewer.widgets::KMLWidget/init()
 at com.esri.solutions.flexviewer.widgets::KMLWidget/___KMLWidget_BaseWidget1_widgetConfigLoaded()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at mx.core::UIComponent/dispatchEvent()
 at com.esri.solutions.flexviewer::BaseWidget/configResult()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
 at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
 at mx.rpc::Responder/result()
 at mx.rpc::AsyncRequest/acknowledge()
 at DirectHTTPMessageResponder/completeHandler()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at flash.net::URLLoader/onComplete()


Maybe this just isn't going to work.
0 Kudos
DasaPaddock
Esri Regular Contributor
What happens when you load the this url directly in your browser?

http://server/proxy.php?http://66.134.213.74/WildEarth/WildCAD_NVSFC.kml
0 Kudos
MatthewLawton
Deactivated User
In Firefox I just get a blank page. In IE8 I get an Internal Server Error.

I guess that probably means I don't have cURL setup correctly.
0 Kudos