08-20-2010 07:11 PM
I'm developing my first BlackBerry application that uses BlackBerry Maps and use BlackBerry Java SDK Location-Based Services Version: 5.0 - Development Guide as a reference document.
Thanks to the guide, I am able to load BlackBerry Maps with Location Document in my application and it works fine. However when I try to invoke BlackBerry Maps by using a KML document hosted in my web server, I receive and error while trying to load KML file from web server:
HTTP 406 Error: Not Acceptable The file you are trying to load is not supported.
Could anyone give me suggestions for this situation?
Any help would be greatly appreciated!!!
This is the content of KML file I'm trying to load:
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Placemark> <name>Ottawa</name> <description>Ottawa office</description> <Point> <coordinates>-90.86948943473118,48.25450093195546,
0</coordinates> </Point> </Placemark> </kml>
and the code to invoke the map:
public void run()
MapsArguments ma = new MapsArguments(MapsArguments.ARG_KML, "http://www.myserver/sample.kml"); Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, ma);
I'm using BlackBerry JDE 6.0 with BlackBerry Curve 8330 simulator.
08-21-2010 12:11 AM - edited 08-21-2010 12:12 AM
406 errors occur when the type of data being served by a server is not in the set of acceptable data to the client.
This suggests the something in the Accept headers of your HTTP request indicates the data being served is not acceptable.
Accept headers include the following:
Something about your data doesn't match the values accepted by BlackBerry Maps.
I'd suggest using Wireshark or similar to see what "Accept" headers BlackBerry Maps issues and then ensure that your data is ok. You could just be missing a mime type setting in your server or maybe the encoding doesn't match.
A crazy thought but you might try changing the file extension to "xml".
08-21-2010 06:14 PM
Thank you BR14 for your detailed respond, I'd try your suggestions and report the result.
Hope you all the best.
08-21-2010 06:33 PM
I've tried to change the file extension to xml but still not succeed.
This is the link to the BlackBerry Developer Documentation that I am following:
Does anyone have any ideas?
08-22-2010 10:26 PM
Have you checked this article?
Looks as though you may need to configure your server mime-types config.
08-23-2010 12:52 PM
I do not intend to use Browser to user BlackBerry Maps, but many thanks for your suggestions.
08-24-2010 12:09 AM
"I do not intend to use Browser to user BlackBerry Maps, but many thanks for your suggestions."
I realise you're not using the browser.
However, clearly Maps is using a HTTP client of some kind and stipulating an acceptable content type or you wouldn't be seeing the 406 error.
You web server needs to set the content type of the KML file to the appropriate mime type. If you're using Apache for example you might edit the mime.types config file.
04-10-2013 09:11 AM
I came across this with the exact same problem and managed to get it working as follows:
Open your text editor (let's assume "Notepad" in Windows) and paste the following text in to your new document:
# Blackberry Maps
Click "Save as" and in the "Save as type" drop down box select "All Files". Name the file ".htaccess" (without the brackets of course) and save it somewhere locally, e.g. your desktop.
Connect to your webspace and locate the folder where you want to store/host you KML maps - copy and paste this new .htaccess file into the same folder - this can be in the root or inside a folder, but crucially, it MUST be in the same folder where the KML files are located.
Finally, in Blackberry maps, try adding the full path to the KML file again.
Hopefully, it should work this time, as it did for me!
Hope this helps!
04-10-2013 09:12 AM