I have a problem with loading a WMS layer using a widget made for Flex Viewer. The server I want to use doesn't have a crossdomain.xml file. I'll show a lot of info here so sorry for a little chaos, but I need a clue what's going wrong.
When I add this layer to config.xml, its working. The site makes a call for crossdomain.xml (results 404) but the layer somehow still works. The code:
<layer url="http://mapy.geoportal.gov.pl/wss/service/pub/guest/G2_BDOT_BUD_2010/MapServer/WMSServer" alpha="1" visible="true" type="wms" label="BDOT" visiblelayers="3,4,5,6" version="1.3.0" skipgetcapabilities="true" imageFormat="png"/>
However if I try to load this layer using a widget it gives a security error.
[FaultEvent fault=[RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Destination: DefaultHTTP"] messageId="62DC1CFD-5BD7-DD2E-44A2-9D0782B55D4C" type="fault" bubbles=false cancelable=true eventPhase=2]
Everything is working when I'm running a local version (using Flex Viewer debug). However if I build the app and put in on server, that's a call for crossdomain.xml the security error occurs.
Widget works like this:
1. call layer URL with GetCapabilities as XML 2. declare new WMSLayer object 3. set the WMSLayer object parameters using values form XML 4. add layer to map
The separate call for GetCapabilities its from my predecessors code. I tried disabling it and turning skipGetCapabilities="false" but it gives me error:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem/createChildren() at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem/onLayerLoad()
on the 472 line of TocMapLayerItem.as file, that's this line:
if (wmsVisibleLayers.source.indexOf(wmsLayerInfo.name) !== -1)
I tried to make a proxy, but that's not working - when on a server my app just tries to call server with WMS layer for crossdomain.xml, and that's all, not trying to use proxy at all.
I'm glad for any help or a clue of what's going on. I'm pretty new to Flex Viewer, I know the crossdomain.xml is needed, but they are not willing to set it up on server, the client wants layers from this server to be available, and THEY ACTUALLY WORK when I simply put them in config.xml instead odd trying to add to map later.
Also my app gives me an error just after loading, don't know if this has something to do with the WMS problem but here it is:
TypeError: Error #1034: Type Coercion failed: cannot convert _index_mx_managers_SystemManager@d3a0999 to flash.display.Bitmap. at spark.primitives::BitmapImage/contentComplete() at spark.primitives::BitmapImage/http://www.adobe.com/2006/flex/mx/internal::loader_completeHandler()