Select to view content in your preferred language

Flex Sample Viewer 2.2

1406
6
03-26-2011 10:46 PM
shay-geo
Frequent Contributor
Is there any documentation on, how to use proxy in config.xml file or proxyURL tag or How to connect to secured services in Flex Viewer 2.2. The sample viewer don't have a proxy support for widgets.

The API for flex documentation has reference on connecting to services using Javascript but not Flex.
http://help.arcgis.com/en/webapi/flex/help/index.html#proxy.htm


Thanks and Regards,
Shail
Tags (2)
0 Kudos
6 Replies
BjornSvensson
Esri Regular Contributor
Hi Shail.

Yes, there is documentation on how to use a proxy to connect to secure services when using the ArcGIS Viewer for Flex. The http://help.arcgis.com/en/webapps/flexviewer/help/index.html#proxy.htm page attempts to describe how to use proxy within the Flex Viewer.

Flex Viewer
Generally speaking, to add a proxy, use the <httpproxy> tag in the main configuration file to specify your proxy. This proxy works as an "opt-in", so you also need to specify what should be proxied.
http://help.arcgis.com/en/webapps/flexviewer/help/index.html#mainconfig.htm

For example, for a specific layer you would "opt-in" using
<layer ... useproxy="true"/>
http://help.arcgis.com/en/webapps/flexviewer/help/index.html#layer_tag.htm

... and for the widgets that support proxy (Data Extract, GeoRSS, Locate, Query, and Search) you would specify it within the configuration file for that widget
<useproxy>true</useproxy>
http://help.arcgis.com/en/webapps/flexviewer/help/index.html#widgets/dataextract_widget.htm
http://help.arcgis.com/en/webapps/flexviewer/help/index.html#widgets/georss_widget.htm
etc

API & proxy doc
The current Flex API docs are about using a proxy for the Flex API.  Not JavaScript API.  However, most of the proxy part applies to both Flex and Javascript applications.   Is there something in http://help.arcgis.com/en/webapi/flex/help/index.html#proxy.htm that is confusing or not clear?

I hope this helps 🙂
0 Kudos
JohnSlusarczyk
Emerging Contributor
Bjorn,

Do you need to tag the main configuration file (proxy.config) or do you tag the proxy.ashx file?  I can't get this to work. Here's what my config.xml file looks like.  I think I've used the <httpproxy> command correctly and I opted "in" each of my map services.

<configuration>
    <httpproxy>http://gis.anokacountymn.gov/highway/flexviewer15/proxy/proxy.ashx</httpproxy>
    <title>Anoka County Highway Department</title>
    <subtitle>County Road Construction Locator</subtitle>
    <logo>assets/images/ACHD Logo.jpg</logo>
    <style>
        <colors>0xFFFFFF,0x333333,0x101010,0x000000,0xFFFFFF</colors>
        <alpha>0.8</alpha>
    </style>

    <!-- UI elements -->
    <widget left="10"  top="50"    config="widgets/Navigation/NavigationWidget.xml" url="widgets/Navigation/NavigationWidget.swf"/>
    <widget left="10" bottom="10" config="widgets/OverviewMap/OverviewMapWidget.xml" url="widgets/OverviewMap/OverviewMapWidget.swf"/>
    <widget right="20" top="55"    config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/MapSwitcherWidget.swf"/>
    <widget left="0"   top="0"     config="widgets/HeaderController/HeaderControllerWidget.xml" url="widgets/HeaderController/HeaderControllerWidget.swf"/>
    <widget right="25" top="85" config="widgets/StaticImage/StaticImageWidget.xml" url="widgets/StaticImage/StaticImageWidget.swf"/>
    <widget left="0" top="0" config="widgets/FeatureTooltip/FeatureTooltipWidget.xml" url="widgets/FeatureTooltip/FeatureTooltipWidget.swf"/>
    


<map initialextent="436718.362679638 98452.4263874347 569018.526467179 238294.935069454"
      fullextent="436718.362679638 98452.4263874347 569018.526467179 238294.935069454"
top="40">

        <basemaps>
            <layer label="BaseMap"  type="tiled" useproxy="true" visible="true" alpha="1"
                   url="http://atlas/arcgis/rest/services/Highway_BaseMap10/MapServer"/>
            <layer label="Aerial"  type="tiled" useproxy="true" visible="false" alpha="1"
                   url="http://atlas/arcgis/rest/services/Aerials3/MapServer"/>

        </basemaps>
        <operationallayers>
           <!---- layer label="Labels" type="tiled" useproxy="true" visible="true"
                   url="http://atlas/arcgis/rest/services/AnokaLabels2/MapServer"/---->
            <layer label="Road Work Labels" type="tiled" useproxy="true" visible="true"
                   url="http://atlas/arcgis/rest/services/Highway_Labels4/MapServer"/>
            <layer label="Road Under Repair" type="dynamic"useproxy="true" visible="true" alpha = "1"
                   url="http://atlas/arcgis/rest/services/HIGHWAY_CONSTRUCTION_SEGMENTS/MapServer"/>
            <layer label="Detours" type="dynamic" useproxy="true" visible="true" alpha = "1"
                  url="http://atlas/arcgis/rest/services/HIGHWAY_CONSTRUCTION_Detours/MapServer"/>         
            <layer label="End Points" type="dynamic" useproxy="true" visible="true" alpha = "1"
                  url="http://atlas/arcgis/rest/services/HIGHWAY_CONSTRUCTION_End_Points14/MapServer"/>
            <layer label="End Points Feature" type="feature" useproxy="true" visible="true" alpha="0"
                   info="widgets/InfoTemplates/AttRelateInfoWinWidget.swf"
                   infoconfig="widgets/InfoTemplates/IWTHwy_EndPts.xml"
                   url="http://atlas/arcgis/rest/services/HIGHWAY_CONSTRUCTION_End_Points14/MapServer/0"/>
            <layer label="Mid Points" type="dynamic" useproxy="true" visible="true" alpha = "1"
                  url="http://atlas/arcgis/rest/services/HIGHWAY_CONSTRUCTION_MidPoints3/MapServer"/>
            <layer label="Mid Points Feature" type="feature" useproxy="true" visible="true" alpha="0"
                   info="widgets/InfoTemplates/AttRelateInfoWinWidget.swf"
                   infoconfig="widgets/InfoTemplates/IWTHwy_MidPts.xml"
                   url="http://atlas/arcgis/rest/services/HIGHWAY_CONSTRUCTION_MidPoints3/MapServer/0"/>
0 Kudos
BjornSvensson
Esri Regular Contributor
Do you need to tag the main configuration file (proxy.config) or do you tag the proxy.ashx file?  I can't get this to work. Here's what my config.xml file looks like.  I think I've used the <httpproxy> command correctly and I opted "in" each of my map services.


I would take a step back, and just make sure that you really need to use the proxy... If you're application is running on http://atlas/something then you probably don't need a proxy.

Also, even if the app is on a different domain than your arcgis server, you can put a crossdomain file at http://atlas/crossdomain.xml, and again probably wont need any proxy.
0 Kudos
JohnSlusarczyk
Emerging Contributor
The application is on a web server in the DMZ, but ArcGIS server is on server Atlas inside the firewall. We have a crossdomain file in place on Atlas and the application works fine internally, but when you try to view it outside our network, none of the map services show up.  We have two other web applications deployed externally that use similar proxy pages to call the services from Atlas.  This is my first crack at using the Sample Flex Viewer.

One other thing to note, when the proxy page is in place and referenced in the code, the map services don't display internally either.  If I remove the proxy page then they display internally but not externally. Any idea?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
John,

   It sounds like you are using a Reverse Proxy Server Configuration. If that is the case than what I do is use the fully qualified map service name in the config.xml not just atlas. Of course it sounds like your configuration might be a little different as my web server with the flex app on it is inside the firewall along with my ArcGIS server and data and the only thing in the DMZ is my reverse proxy server.
0 Kudos
JohnSlusarczyk
Emerging Contributor
I tried swapping out the fully qualified name (http://atlas.co.anoka.mn.us) but that didn't work.

I suspect the problem might be proxy tag in the configuration section of the config.xml  Can anyone verify that the <httpproxy> line of this code looks correct?

<configuration>
    <httpproxy>http://gis.anokacountymn.gov/highway/flexviewer15/proxy.ashx</httpproxy>
    <title>Anoka County Highway Department</title>
    <subtitle>County Road Construction Locator</subtitle>
    <logo>assets/images/ACHD Logo.jpg</logo>
    <style>
        <colors>0xFFFFFF,0x333333,0x101010,0x000000,0xFFFFFF</colors>
        <alpha>0.8</alpha>
    </style>
0 Kudos