Mar 21, 2011 at 10:49 PM
Edited Mar 21, 2011 at 10:50 PM
|
I have a strange problem relating to a C# WCF Data Service, and a iOS client (using the oData SDK).
Here is a simplified version of my WCF Data Service:
using System;
using System.Data.Services;
using System.Data.Services.Common;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using FootballFeedsModel;
[ServiceBehavior]
public class FootballFeeds : DataService<FootballFeedsEntities > {
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.All);
config.SetServiceOperationAccessRule("TeamsList", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
[WebGet (ResponseFormat = WebMessageFormat.Json)]
public IQueryable<Team> TeamsList(){
return new FootballFeedsEntities().Teams.AsQueryable();
}
}
The services is currently hosted live, so I can confirm that I can browse to it, and navigate through the Entity collection etc.
I wrote the following code in my iOS application simply to test the connection to the service:
FootballFeedsEntities *proxy = [[FootballFeedsEntities alloc] initWithUri:@"http://testwebserver.com/Services/FootballFeeds.svc" credential:nil];
DataServiceQuery *query = [proxy teams];
QueryOperationResponse *response = [query execute];
resultArray =[[response getResult] retain];
if([resultArray count] > 0 )
{
NSLog(@"Got Results");
}
However the connection simply hangs after I get a 200 status code (there are only 5 items in the database, so I know it is not an issue with the size of the data).
However if I change the code to read from the oData Northwind service, (and add files for this service produced by odatagen)
NorthwindEntities *proxy = [[NorthwindEntities alloc] initWithUri:@"http://services.odata.org/Northwind/Northwind.svc" credential:nil];
DataServiceQuery *query = [proxy teams];
QueryOperationResponse *response = [query execute];
resultArray =[[response getResult] retain];
if([resultArray count] > 0 )
{
NSLog(@"Got Results");
}
I get results as expected. I am at a loss as to what the missing piece of my jigsaw is, so any pointers would be really helpful.
Regards
|