Problem using WMS service in Flex Viewer 2.1

3323
16
09-28-2010 12:34 PM
PaulHeinrich
New Contributor
Hello,

I'm trying to use the Arizona Geologic Survey geologic map service in a Flex Viewer project.  The service is a WMS service.  When I add it as a operational layer it does not display.  I'm wondering if there is a problem with the service or the way in which I'm referencing it?

Here's the service link..

http://services.azgs.az.gov/arcgis/services/OneGeology/AZGS_Arizona_Geology/MapServer/WMSServer

Here's the web site for the service.. http://www.azgs.state.az.us/services_azgeomap.shtml

and here's my tag from my Flex Viewer project..

<layer label="Arizona Geology" type="dynamic" visible="false" alpha="1" url="http://services.azgs.az.gov/arcgis/services/OneGeology/AZGS_Arizona_Geology/MapServer/WMSServer"/>

cheers,  Paul
Tags (2)
0 Kudos
16 Replies
DasaPaddock
Esri Regular Contributor
The Viewer doesn't support wms services yet. (The API does as of 2.1.)

You can try using their ArcGIS REST service here instead:
http://services.azgs.az.gov/arcgis/rest/services/OneGeology/AZGS_Arizona_Geology/MapServer

You'll need to use a proxy though since they don't have a cross domain policy file at:
http://services.azgs.az.gov/crossdomain.xml
0 Kudos
MehulChoksey
Esri Contributor
Hi Paul,

WMS is not supported in "ready to deploy" ArcGIS Flex Viewer 2.1.
WMS support will be added to viewer in in future release.

For list of supported layer types see: http://help.arcgis.com/en/webapps/flexviewer/help/Default.htm#CSHID=layer_tag.htm|StartTopic=layer_t...

If you are working with the source, then you can take advantage of ArcGIS API for Flex 2.1 to add support for WMS see sample at: http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=WMS
and
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/WMSLayer.html
0 Kudos
PaulHeinrich
New Contributor
The Viewer doesn't support wms services yet. (The API does as of 2.1.)

You can try using their ArcGIS REST service here instead:
http://services.azgs.az.gov/arcgis/rest/services/OneGeology/AZGS_Arizona_Geology/MapServer

You'll need to use a proxy though since they don't have a cross domain policy file at:
http://services.azgs.az.gov/crossdomain.xml


I dropped the link you pointed out into my application and it works great on the desktop.  Will I need a proxy to run it from my server?  I've never set that up, so I'm wondering what I'll need to do.

cheers,  Paul
0 Kudos
DasaPaddock
Esri Regular Contributor
See the page in the TOC called "Using proxy" under the Concepts at:
http://help.arcgis.com/en/webapps/flexviewer/help/index.html
0 Kudos
ThomasHynes
New Contributor III
Hi Paul,

WMS is not supported in "ready to deploy" ArcGIS Flex Viewer 2.1.
WMS support will be added to viewer in in future release.

For list of supported layer types see: http://help.arcgis.com/en/webapps/flexviewer/help/Default.htm#CSHID=layer_tag.htm|StartTopic=layer_t...

If you are working with the source, then you can take advantage of ArcGIS API for Flex 2.1 to add support for WMS see sample at: http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=WMS
and
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/WMSLayer.html



Is there an easy way to integrate this so that a wms could be added to the operational layers.  Something like creating a new case (under "private function addLayerToMap" in MapManager.mxml)?

I attempted this, but it did not work.  I am comfortable with writing python automation scripts, but am new to flex coding. 

case "wms":
{
var webmsLayer:WMSLayer = new WMSLayer(url);
webmsLayer.alpha = alpha;
webmsLayer.id = label;
webmsLayer.name = label;
webmsLayer.token = token;
webmsLayer.visible = visible;
if (autoRefresh > 0)
{
  setInterval(webmsLayer.refresh, autoRefresh * 1000);
}
if (visibleLayers)
{
  var vizLayers:Array = visibleLayers.split(",");
  for (var i:int = 0; i < vizLayers.length; i++)
  {
   vizLayers = Number(vizLayers); // convert to Numbers
  }
  webmsLayer.visibleLayers = new ArrayCollection(vizLayers);
}
if (proxyUrl && useProxy)
{
  webmsLayer.proxyURL = proxyUrl;
}
if (operationalLayer)
{
  layerObject.layer = webmsLayer;
}
map.addLayer(webmsLayer);
break;
}
0 Kudos
PaulHeinrich
New Contributor
See the page in the TOC called "Using proxy" under the Concepts at:
http://help.arcgis.com/en/webapps/flexviewer/help/index.html


Thanks Dasa,

I've installed the proxy.ashx and proxy.config and added a useproxy="true"  to my geology operational layer.

My proxy.config looks like this...

<?xml version="1.0" encoding="utf-8" ?>

<ProxyConfig mustMatch="true">
  <serverUrls>
    <serverUrl url="ttp://services.azgs.az.gov/arcgis/rest/services/OneGeology/AZGS_Arizona_Geology/MapServer"
               matchAll="true"></serverUrl>
    </serverUrls>
</ProxyConfig>

and my operational layer look like this...

<layer label="Arizona Geology" useproxy="true" type="dynamic" visible="false" alpha="0.5" url="http://services.azgs.az.gov/arcgis/rest/services/OneGeology/AZGS_Arizona_Geology/MapServer"/>
       
but the layer still does not display in my application.

Do I need to add "esri.config.defaults.io.proxyUrl = "proxy.ashx";" in my application?  If so, where should I set it?

cheers,  Paul
0 Kudos
DasaPaddock
Esri Regular Contributor
You need to add <httpproxy>proxy.ashx</httpproxy> to the root (like the title) of your config.xml to tell the Viewer what the url to the proxy is.

You're also missing the 'h' in http in the url on your serverUrl in the proxy.config. You don't have to give it the full url. You can just use the start like this "http://services.azgs.az.gov/".
0 Kudos
PaulHeinrich
New Contributor
You need to add <httpproxy>proxy.ashx</httpproxy> to the root (like the title) of your config.xml to tell the Viewer what the url to the proxy is.

You're also missing the 'h' in http in the url on your serverUrl in the proxy.config. You don't have to give it the full url. You can just use the start like this "http://services.azgs.az.gov/".


Thanks Dasa,  That did it.

cheers,  Paul
0 Kudos
StephenGates
New Contributor II


WMS is not supported in "ready to deploy" ArcGIS Flex Viewer 2.1.
WMS support will be added to viewer in in future release.

For list of supported layer types see: http://help.arcgis.com/en/webapps/flexviewer/help/Default.htm#CSHID=layer_tag.htm|StartTopic=layer_t...

If you are working with the source, then you can take advantage of ArcGIS API for Flex 2.1 to add support for WMS see sample at: http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=WMS
and
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/WMSLayer.html


Hi ,
are you able to share what's coming in the next Flex Viewer release?

thanks

Stephen
0 Kudos