tags:

views:

142

answers:

2

Hi,

I try to insert features on a custom google map : i use the sample code from the doc but i get a ServiceException (Internal server error) when i call the service's insert method.

Here is what i do :

  • I create a map and get the resulting MapEntry object :
myMapEntry = (MapEntry) service.insert(mapUrl, myEntry);

This works fine : i can see the map i created in "my maps" on google.

  • I use the feed url from the map to insert a feature :

final URL featureEditUrl = myMapEntry.getFeatureFeedUrl();

  • I create a kml string using the sample from the doc :
String kmlStr = "< Placemark xmlns=\"http://www.opengis.net/kml/2.2\"&gt;"

                + "<name>Aunt Joanas Ice Cream Shop</name>" 
                + "<Point>" 
                + "<coordinates>-87.74613826475604,41.90504663195118,0</ 
coordinates>" 
                + "</Point></Placemark>";
  • And when i call the insert method i get an internal server error.

I must be doing something wrong but i cant see what, can anybody help ?

Here is the complete code i use :

    public void doCreateFeaturesFormap(MapEntry myMap) 
                        throws ServiceException, IOException { 
                final URL featureEditUrl = myMap.getFeatureFeedUrl(); 
                FeatureEntry featureEntry = new FeatureEntry(); 
                try { 
                        String kmlStr = "<Placemark xmlns=\"http://www.opengis.net/kml/ 
2.2\">" 
                                + "<name>Aunt Joanas Ice Cream Shop</name>" 
                                + "<Point>" 
                                + "<coordinates>-87.74613826475604,41.90504663195118,0</ 
coordinates>" 
                                + "</Point></Placemark>"; 
                        XmlBlob kml = new XmlBlob(); 
                        kml.setFullText(kmlStr); 
                        featureEntry.setKml(kml); 
                        featureEntry.setTitle(new PlainTextConstruct("Feature Title")); 
                } catch (NullPointerException e) { 
                        System.out.println("Error: " + e.getClass().getName()); 
                } 
                FeatureEntry myFeature = (FeatureEntry) service.insert( 
                                featureEditUrl, featureEntry); 
        } 

Thanks in advance, Vincent.

A: 

i too get this exact problem. Did anyone manage to solve it?

A: 

For future reference, it was an error in their example. Here's the issue:

http://code.google.com/p/gdata-java-client/issues/detail?id=285

Replace setFullText(KML) with setBlob(KML)

José Cervera