I've been using the WmsLayer for my WMS Service needs, rather than my old way of doing things by sussing out a GetMap URL and posting that image to a GraphicsLayer. It's been working well but I seem to have found a service that breaks it.
Here is the getCapabilities URL I'm using:
I'm able to to get the Name of the layers available (they're using simple numbers to ID them). I provide the WmsLayer the getCapabilitiesURL, the layer ID number & a Proxy Url based upon the proxy handler from the documentation here at ESRI. Unfortunately that doesn't seem to be enough. When debugging, I crash to an unhandled exception as soon as I add it to my map control.
Category: ManagedRuntimeError Message: System.InvalidOperationException: Sequence contains no elements
Using Firebug to look at my hosted application, it reports this error:
Unhandled Error in Silverlight Application Data at the root level is invalid. Line 1, position 1. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options) at ESRI.ArcGIS.Client.Toolkit.DataSources.WmsLayer.client_DownloadStringCompleted(Object sender, DownloadStringCompletedEventArgs e) at System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs e) at System.Net.WebClient.DownloadStringOperationCompleted(Object arg)
The XML returned by the GetCapabilities call seems sound to me - at least it appears like all of the other WMS services I've been communicating with - so I'm not sure what parsing errors it is running into. Any ideas? I can provide further info if there is something I haven't thought to check.