Hi,

I am trying to upload a xml file to google my maps that follows the following 
protocol:

http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#uploading_xml

POST http://maps.google.com/maps/feeds/maps/userID/full
Content-type: application/atom+xml
Authorization: GoogleLogin auth="authorization_token"

<entry xmlns="http://www.w3.org/2005/Atom";>
  <title>My Map</title>
  <summary>My Description</summary>
</entry>

I am using the following code:

        if (appDelegate.authGoogleKey != nil) {
                
                NSString *urlStr = [NSString 
stringWithFormat:@"//maps.google.com/maps/feeds/maps/%@/full", txtEmail.text];  
           
                NSURL *url = [NSURL URLWithString:urlStr];
                
                NSMutableURLRequest *uploadRequest = [NSMutableURLRequest 
requestWithURL:url];
                
                [uploadRequest setHTTPMethod:@"POST"];
                
                //set headers           
                [uploadRequest addValue:@"Content-Type" 
forHTTPHeaderField:@"application/atom+xml"];            
                [uploadRequest addValue:@"Authorization" 
forHTTPHeaderField:@"GoogleLogin"];
                [uploadRequest addValue:@"auth" 
forHTTPHeaderField:appDelegate.authGoogleKey];
                
                NSString *requestBody = @"<entry 
xmlns=\"http://www.w3.org/2005/Atom\";><title>My Map</title><summary>My 
Description</summary></entry>";
                [uploadRequest setHTTPBody:[requestBody 
dataUsingEncoding:NSASCIIStringEncoding]];
                
                NSData *returnData = [NSURLConnection 
sendSynchronousRequest:uploadRequest returningResponse:nil error:nil];
                NSString *returnString = [[NSString alloc] 
initWithData:returnData encoding:NSUTF8StringEncoding];
                NSLog(@"Response: %@ ", returnString);
                
                [returnString release];

        }else{
        
                NSLog(@"Not logged in");
        }


I am not getting a response back, which indicates my post method is wrong. Can 
anyone help me out?

Thanks,



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to