8 Replies Latest reply on Jan 22, 2013 8:15 AM by stevemclesri

    Loading Dynamic KML from web service

    derickson48
      I am attempting to use ArcGIS API for Javascript to view KML from a dynamic REST webservice of a 3rd party app server that I control.  To test this I have downloaded the html source for the KMLLayer example and am modifying the kmlUrl variable to hit my service.
      http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/layers_kml.html

      var kmlUrl = 'http://localhost:6040/service/query/etc/1.kml';
      var kml = new esri.layers.KMLLayer(kmlUrl);
      map.addLayer(kml);

      The data does not appear.  However, if I download the URL to a static KML file and upload that to a public file webhosting (in this case my public DropBox) and then adjust the code to pull from the static URL hosting location, it works just fine.

      Could the localhost or high number port be causing the problem?
      Could any HTTP response headers mess up the KMLLayer constructor?  The webserver is setting the content type to "application/vnd.google-earth.kml+xml", which I believe is correct.

      Thanks in advance for help,
      Dave