oag_hboyce


Hello,

I've been working and evaluating both VE and MapPoint Web Services for use publicly and privately within my organization. Recently, I was asked to plot all the office locations on a map. I decided to use MapPoint to geocode the locations on the server and generate a GeoRSS file to use within the web page with the VE control. I discovered that even with the MIME Content Type specified (as application/rss+xml), the VE control will not load the push-pins into the layer if the LayerSource does not contain a ".XML" extension when the Layer Type is set as GeoRSS.

Please consider removing this limitation in future versions of the control. I don't believe that developers using VE should have to generate a physical XML file for the control to plot geocoded RSS data.

Thanks,

Harris




Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

Caleb T - MSFT


Wow. Yeah, good catch.

I've logged a bug against this.






Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

oag_hboyce

Thanks. Keep up the great work!

Is there anyway for me/others to know when this is fixed






Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

Dave Britton - VERTIGO

oag_hboyce wrote:
Hello,

I've been working and evaluating both VE and MapPoint Web Services for use publicly and privately within my organization. Recently, I was asked to plot all the office locations on a map. I decided to use MapPoint to geocode the locations on the server and generate a GeoRSS file to use within the web page with the VE control. I discovered that even with the MIME Content Type specified (as application/rss+xml), the VE control will not load the push-pins into the layer if the LayerSource does not contain a ".XML" extension when the Layer Type is set as GeoRSS.

Please consider removing this limitation in future versions of the control. I don't believe that developers using VE should have to generate a physical XML file for the control to plot geocoded RSS data.

Thanks,

Harris

Sounds like deja-vous. I had to do something similar and ended up using my own XML format (that I could dynamically generate) and then plotting my own pins/lines based on it's content. Guess I never really thought of it as a bug, just a limitation ....... Not sure if you could reference your xml with query params then redirect to something that handles the query param(s) and returns the correct mime type






Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

oag_hboyce

Dave Britton - VERTIGO wrote:

Sounds like deja-vous. I had to do something similar and ended up using my own XML format (that I could dynamically generate) and then plotting my own pins/lines based on it's content. Guess I never really thought of it as a bug, just a limitation ....... Not sure if you could reference your xml with query params then redirect to something that handles the query param(s) and returns the correct mime type



It appears to be tied to the extension because when I used a "static" .XML file, it worked fine; however if I pointed it at "/mygeorss.ashx" - which dynamically builds the GeoRSS file, it doesn't work even with the mime type as "application/rss+xml".





Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

Dave Britton - VERTIGO

oag_hboyce wrote:
Dave Britton - VERTIGO wrote:

Sounds like deja-vous. I had to do something similar and ended up using my own XML format (that I could dynamically generate) and then plotting my own pins/lines based on it's content. Guess I never really thought of it as a bug, just a limitation ....... Not sure if you could reference your xml with query params then redirect to something that handles the query param(s) and returns the correct mime type



It appears to be tied to the extension because when I used a "static" .XML file, it worked fine; however if I pointed it at "/mygeorss.ashx" - which dynamically builds the GeoRSS file, it doesn't work even with the mime type as "application/rss+xml".

How about you reference an XML file, that does not exist in your site .... then in your Global.asax or wherever you trap the error, at which point you server.transfer to your resource page and return something usefull, your XML from in there It's as good a hack as I can think of right now






Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

Caleb T - MSFT

I passed this on to one of the devs and here's the general response: As you know, the file extension tells the browser what MIME type to use, and the map control relies on the browser to interpret the file. Since we (and you as the dev of your mashup site) can't control MIME mappings on the client, there is little that can be done in that regard.

HOWEVER, I think this is simply a matter of how you are setting the MIME type when you generate the file. Here (http://www.geograph.org.uk/syndicator.php format=GeoRSS) is a sample feed I found on the GeoRSS.org web site. Notice that it is a .php page that auto-generates a GeoRSS file (no .xml extension). It works in my VE mashup without a problem.





Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

oag_hboyce

 Caleb T - MSFT wrote:

I passed this on to one of the devs and here's the general response: As you know, the file extension tells the browser what MIME type to use, and the map control relies on the browser to interpret the file. Since we (and you as the dev of your mashup site) can't control MIME mappings on the client, there is little that can be done in that regard.

HOWEVER, I think this is simply a matter of how you are setting the MIME type when you generate the file. Here (http://www.geograph.org.uk/syndicator.php format=GeoRSS) is a sample feed I found on the GeoRSS.org web site. Notice that it is a .php page that auto-generates a GeoRSS file (no .xml extension). It works in my VE mashup without a problem.



Thank you. After some inspection in Firefox, the MIME type that is set by the server is "application/xml" instead of one of the "application/*+xml" flavors (I do not know of a way to do this in IE - document/page properties just said "XML Document" or "ASP.NET Generic Handler" when the mime type was app/xml and app/rss+xml, respectively); I changed the MIME type in my handler and everything worked great.

I realize that all this is Beta and not everything is complete, but it would be great if this requirement were to make it into the documentation for VE regarding GeoRSS and layers.

Again, thanks for your assistance.




Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

Jared H

Looks like this one is answered, but for reference I can offer the following solution which has been working for me since the release of v3.  To consume a web data source (assuming something at least in an XML format like an RSS feed which requires some additional work to create a GeoRSS document) the steps I took were as follows:

1)  From the client, in this case a simple .htm container for the map control, set the .LayerSource to an HttpHandler (.ashx removes the overhead of having to custom-map the extension to ISAPI.dll):

var veLayerSpec = new VELayerSpecification();

veLayerSpec.Type = VELayerType.GeoRSS;

veLayerSpec.ID = layerID;  // (remember to declare and increment this variable for multiple layers)

veLayerSpec.LayerSource = "HttpHandlers/Any_Source_Xml_or_Otherwise_Xslt.ashx dataSource="+variableDataSource+"&lat="+locArray[0]+"&lon="+locArray[1];

veLayerSpec.Method = 'get';

veLayerSpec.FnCallback = onFeedLoad;

2)  Wtihin the ProcessRequest method of the HttpHandler, I'm creating an HttpWebRequest and streaming the response back to a StringReader, where the dataSource querystring variable is used to determine the location of the data and if additional work is required to obtain the raw xml [example, the NWS experimental .asmx requires a customized Soap client -- that was fun figuring out and can chat that up if anyone else has tried and run into issues].

3)  With ReadToEnd(), the StringReader pulls the xml into an in-memory XPathDocument, which can then be cached by name and lat/lon for however long the web service requires by it's Terms of Use agreement.

4)  Finally (example here with the 2.0 Framework xslt classes), the dataSource variable again specifies which stylesheet to fetch, and I handle transforming --if needed-- the raw xml into a GeoRSS spec'd xml document, and then pass the transform result to the HttpResponse Stream.  That's it, and at no point is there a physical .xml file generated to the file system, and no issues with MIME types.

public void GeoRSSTransform(ref XPathDocument xmlFromTheWeb)

{

XslCompiledTransform xslt = new XslCompiledTransform();

xslt.Load(HttpContext.Current.Server.MapPath("../ClientStyles/Variable_StyleSheet.xsl"));

xslt.Transform(xmlFromTheWeb, null, HttpContext.Current.Response.Output);

}

 Note:  Here is the other post where I have explained the .xsl stylesheet usage a little more in depth -- both posts are related. http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=659088&SiteID=1&mode=1





Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

MikeyB987

Hi,

Glad I found this thread, was having trouble getting my ASMX generated GeoRSS file to be recognised.

Managed to change the MIME type to "application/*+xml" as oag_hboyce said, and it now works in Firefox, but not in IE.
IE still throws the error "Unable to load source file"

Here are the http headers returned from the ASMX page (IE & Firefox show the same headers being returned)
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 18 Dec 2006 11:17:38 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: application/*+xml
Content-Length: 5589

You can see the Content-Type is application/*+xml and as I say it works fine in Firefox.
What else can I do make it also work in IE

P.S. I don't fully understand your post Jared H

Cheers
Mike





Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

MikeyB987

A happy new year to all.

I'm still cannot get this to with in IE6 (don't know about IE7, might try an install on another PC somewhere)
This is now becoming a real problem for the application I'm developing as internally within the company we only use IE.

Just to recap, I changed the Content-Type to application/*+xml and it now works in Firefox, but IE still refuses to load the xml data.

Mike





Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

Vuduchile66

I'm in the same boat as everybody else here. My HttpHandler works with the map in FireFox but in IE 7 I get the "Unable to load the source file". I've taken the output from my HttpHandler and created a file out of it. Placed that on the file system and referenced the file (via HTTP) instead the url of my HTTPHandler and it works in both browsers.

I also referenced the PHP example feed from above and it works in my map too. So I am guessing that there something incorrect with my HTTP Handler.

Any ideas

Eric

HttpRequest Request = context.Request;
HttpResponse Response = context.Response;
Response.ContentType = "application/*+xml";
Response.ContentEncoding = System.Text.UTF8Encoding.UTF8;
Response.Buffer = true;

// This handler is called whenever a file ending in .sample is requested. A file with that extension does not need to exist.

RssDocument RssDoc = new RssDocument();
RssDoc.Version = 2.0M;
RssChannel RssChan = new RssChannel();
RssChan.Title = "foo Location";
RssChan.Description = "Locations that are authorized to accept payments to foo customer accounts";
RssChan.Link = @"http:\\www.foo.com";

RssDoc.Channel = RssChan;

List<RssChannelItem> RSSItems = new List<RssChannelItem>();
for( int i = 1; i < 6; i++ )
{
RSSItems.Add( new RssChannelItem( string.Format( "Feed Title {0}", i ), "
http://foo.com", string.Format( "Feed Descrription for RSS Item {0}", i ), System.DateTime.Now.Date.ToString(), string.Empty, "44.632838", "-123.09497" ) );
}

RssDoc.Channel.Items = RSSItems;

Response.Write( RssDoc.ToString( System.Text.Encoding.UTF8 ) );





Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

Vuduchile66

I used LiveHTTP Headers in FireFox and copied the ContentType they used which was "application/xml; charset=ISO-8859-1; filename=GeoRSS.xml"; and it worked. So if you are creating your own Generic Handler in ASP.Net be sure to include that in your content type.

For seaching later on here are some keywords that engines should pick up: GeoRSS Generic Handler IHTTPHandler HTTPHandler Virtual Earth ASP.Net XML Filename HttpResponse LayerSource VEShapeSourceSpecification VEShapeLayer





Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

Bernstable

I thought this thread was going to solve it all!! But I just cannot seem to get things working with a georss file unless it has an xml extension. I am using asp to generate my xml. Setting the content type to 'application/xml' and obviously the extension is .asp

If I refer to the .asp file I get an error. If I refer to an identical file (minus the line that sets content type) with a .xml extension it works fine.

Is there a definitive solution to this or is there a work around

regards

Bernie






Re: BUG: VELayerSpecification.LayerSource Requires ".XML" Extension for GeoRSS

Vuduchile66

Bernstable wrote:
I thought this thread was going to solve it all!! But I just cannot seem to get things working with a georss file unless it has an xml extension. I am using asp to generate my xml. Setting the content type to 'application/xml' and obviously the extension is .asp

If I refer to the .asp file I get an error. If I refer to an identical file (minus the line that sets content type) with a .xml extension it works fine.

Is there a definitive solution to this or is there a work around

regards

Bernie


Did you try using a filename in the ContentType For example: using the ContentTypeof "application/xml; charset=ISO-8859-1; filename=GeoRSS.xml" worked for me.