Your input on scenarios

Topics: jQuery
Coordinator
Nov 5, 2010 at 3:32 AM

Hi folks,

Have yout tried building a JavaScript-heavy website/app using a web service as the backend? Do you plan to? In the WCF team we are trying to understand how we can make this experience better for developers and we need your help.

What are the common scenarios where as you are building a JavaScript site/app and you find it necessary to build a web service as well? Reply to this thread land let us know.

This will help us prioritize and ensure we make common use cases great with WCF.

Thanks,
-Yavor Georgiev
Program Manager, WCF 

Nov 5, 2010 at 12:42 PM

Hi

At a UK marketing agency we are using MVC and WCF interchangeably to generate XML and Json for the following main specs - for content managed sites and Facebook apps. WCF is typically chosen if no admin back end is being authored in MVC. Our data access is always Entity Framework. Client side jQuery is always used eg. consume generated Portable Contacts JSON to render Friends list, consume generated Media Rss based Json to render HTML5 slideshow.

Generate: Media Rss (http://video.search.yahoo.com/mrss), Portable Contacts (http://portablecontacts.net/draft-spec.html), Activity Streams (http://activitystrea.ms/head/json-activity.html)

Consume: Twitter API, Facebook Open Graph, Flickr, Vimeo (http://vimeo.com/api/docs/authentication)

Oauth, XRDS discovery, Pagination via JSON-C style array wrappers, Cross Domain Policy file for Flash clients, web friendly status codes are the common stumbling blocks or custom elements required in developing a project. A LinqPad type query browser within Visual Studio would help test JSON web services rather than having to author many HTML test pages.

My preference is light weight fluent code based customisation, rather than XML and conventions customisation.

Andy

Coordinator
Nov 5, 2010 at 10:58 PM
Edited Nov 5, 2010 at 10:59 PM

Hey Andy - thanks for the feedback!

Let me echo back what you said to make sure I understand. You have these scenarios:

Scenario 1. You are building widgets for a variety of sties including Facebook. Those widgets need data coming from your own server, and common data shapes include: Media RSS, Portable Contacts, Activity Streams. Correct me if I'm wrong, but all of these formats are JSON-based (does that include Media RSS?). Does that capture it?

Scenario 2. This is a consumptive scenario where you talk to third-party APIs. You are not building a service in this case, so I'm not sure WCF can help you here. But we are definitely interested in making sure that APIs such as the third-party APIs you list can be built using WCF.

Regarding the pain points you listed:

  1. OAuth/XRDS - this seems to be part of Scenario 2, is that right? When it comes to Scenario 1, do you expect to be able to use OAuth to authenticate users in your own backend services?
  2. Can you clarify what you mean when you say JSON-C array wrappers? I couldn't easily find out from the JSON-C documentation
  3. Also can you clarify what you mean by web-friendly status codes?
  4. I see how a test page can add value to both Scenario 1 and 2, thanks.

Cheers,
-Yavor

Nov 8, 2010 at 11:42 AM

Hi

Yes, that's the major scenarios for our multimedia projects.

For Scenario 1 we are mapping Media Rss xml elements to json. For Scenario 2 we are consuming the social feeds using light weight REST then often generating our own service - so a simple proxy - which has basic caching, rate limiting and projecting this data to our chosen standard formats for client rendering. 

Pain point items:

[1] Yes, OAuth Server code too to allow users from Facebook to in turn consume protected endpoints on our servers.

[2] The Json-C style guide I've been using is http://google-styleguide.googlecode.com/svn/trunk/jsoncstyleguide.xml, arrays of "items", with "totalItems", "startIndex", "itemsPerPage" etc. In MVC there are samples using the likes of PagedList. We need similar helpers for services to then encode this meta information into the output Json.

[3] Quick fluent code to return 304 Not Modified and 404 Not found were appropriate, potentially using Etags.

Andy