4

I just did some research on the web, on how can I easily expose SQL Server database using REST and it boils down to two different stuff, WCF and WCF Data Service. I actually want to have my database be exposed in REST. So what do you guys think is the easiest, fastest, and most efficient way to do this?

I know that using WCF Data Services I can expose the data using OData protocol, which is atom. I wanted to use this data on the iPhone actually. Which then I would need to add this library on my iPhone. It seems that the CTP version of this library only handles read only, while I also want to write to the database.

1 Answer 1

2

Without really knowing what you want to do, I would say the easiest and most efficient way would be to use WCF Data Services.

You don't necessarily have to include a library to consume a WCF Data Service's OData feed. The service is just returning either XML or JSON, based on what you set in your Accepts header:

For XML (which is the default format):

Accepts: application/atom+xml

For JSON:

Accepts: application/json

Your interaction with your WCF Data Service is all through HTTP. The client libraries you're looking at just help you with those calls, but if you can program against HTTP with Objective-C, then you don't need it.

Plus, WCF Data Services and OData supports all CRUD operations using the HTTP verbs GET, POST, PUT and DELETE (and MERGE, which is new for this protocol, I believe). If, in your iPhone app, you can create HTTP requests using POST, PUT and DELETE verbs/methods, then your service will support that.

So I'd go with WCF Data Services. Just watch out if you're dealing with the raw output that it can be kind of verbose. If you can handle JSON in your iPhone app, I'd go that way to cut down on the size of the payloads.

And I should say that I'm not an iPhone developer, so I may be missing something here. Hopefully this helps and let me know if there are other questions and I'll update my answer accordingly.

Thanks.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm not familiar with programming for the iPhone w/ Objective-C, but you would set it with your Request object headers.
FYI MERGE has been removed from OData v4. MERGE was used to do PATCH before PATCH existed. Now that we have PATCH, we no longer need MERGE. See docs.oasis-open.org/odata/new-in-odata/v4.0/cn01/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.