Select to view content in your preferred language

DynamicMapServiceLayer Load Failure

782
5
11-17-2010 09:42 AM
DouglasJones
Emerging Contributor
Hello,

In my application I am consuming WMS and REST serivces using the WmsLayer and ArcGISDynamicMapServicesLayer layers. From time to time the remote host bogs down or is unavailable. When this occurs no data is returned and the underlying WebRequests eventually timeout or fail. Is there any built in mechanism (Error event?) that will provide information to my application if the underlying WebRequest fails?

Thanks,
Doug
0 Kudos
5 Replies
JenniferNery
Esri Regular Contributor
Sure, you can subscribe to InitializedFailed event, both WMS layer and ArcGISDynamicMapServiceLayer have this.  http://help.arcgis.com/en/webapi/silverlight/2.1/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Layer~...

You may also subscribe to Initialized event and check for when the layer's InitializationFailure is not null.http://help.arcgis.com/en/webapi/silverlight/2.1/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Layer~...
0 Kudos
DouglasJones
Emerging Contributor
Hi Jennifer,

Thanks for the response. After some more thourough testing I verfied that listening for the InitilaizationFailure event works as you suggested on the ArcGISDynamicMapServiceLayer. However, on the WmsLayer it only works when SkipGetCapabilities is false and the GetCapabilities call fails. If I set SkipGetCapabilities to true or the GetCapabilites call succeeds, and then the subsequent call to GetMap fails, no problem is indicated. The result is no data loaded and there is no way to know that an error occurred. I realize this is an issue with the host and the assumption is made that if GetCapabilities succeeds then the GetMap call should also succeed. But this precisely the issue I am running into. Any suggestions?

Thanks,
Doug
0 Kudos
JenniferNery
Esri Regular Contributor
When GetMap request is made, the WMS layer has already initialized without failure.  You can  verify this with Fiddler. Capabilities are retrieved during Initialize(), which means that your host at this point must have been available. 

However, we do not have an event that is raised when GetMap request fails.  What you can do is override GetUrl() of the WMS layer, create a delegate for the OnUrlComplete parameter so you can do the error-handling yourself. http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client.Toolkit.DataSources~ESRI.ArcG...
0 Kudos
DouglasJones
Emerging Contributor
Hi Jennifer,

I have overridden the GetUrl method and assigned a custom OnUrlComplete handler. My question now is what to do inside the OnUrlComplete handler? I am guessing I need to issue a WebRequest to load the remote resource for the WmsLayer but I'm not sure what else is required. Is this documented somewhere?

Thanks,
Doug
0 Kudos
JenniferNery
Esri Regular Contributor
The closest I found online is this GetUrl (http://rexdotnet.blogspot.com/2010/09/use-google-maps-with-arcgis-silverlight.html). You are correct try to create the WebClient request from here.

Maybe this would help too: http://forums.silverlight.net/forums/p/116593/445906.aspx
0 Kudos