How to post data into server from iPhone using OData

Sep 1, 2010 at 9:12 AM

Hi, 

I have a web service exposing OData API's. 

All I need to do now is to submit the data from my iPhone into the webserver using OData. 

Is there any sample application that is available for using OData API's in iPhone. 

 

Regards

Hitesh V

Sep 3, 2010 at 5:57 AM

In the user guide under the Doc directory there are some samples on how to persist changes on the server, the following code snippet shows how to update a field in the DB.

hope this helps

Claudio

 

@try

{

   NorthWindEntites *proxy= [[NorthWindEntites alloc]   
   initWithUri:@"http://localhost:13985/ACSNorthWindDataService.svc/"];
   QueryOperationResponse *response  =[query execute:@” Customers(‘CHAN5’”];
    Customer *customer = [[response getResult] objectAtIndex:0];
    //update the CompanyName property 
    [customer setCompanyName:@"Channel13"]; 
    //add the object to the list of objects that needs to be updated in the database 
    [proxy updateObject:customer]; 
    //SaveChanges updates the object in the data service 
    [proxy saveChanges];
}

@catch(DataServiceRequestException *exception)

{
        NSLog(@”Exception = %@”, [exception reason]);  
}

@catch(ODataServiceRequestException *ex)

{
        NSLog(@”Exception = %@”, [ex reason]);  
}