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" 

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()

1 Answer 1


I didnt solve the problem directly, but I managed a workaround with proxing manually:

  1. set HTTPService property useProxy to false
  2. make a function that compares the domain adress with the target WMS layer adress
  3. if domains are diffrent, add proxy adress to beginning of layer URL

Now loading WMS layers works even without crossdomain.xml on target server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.