Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Silverlight TV 26: Exposing SOAP, OData, and JSON Endpoints for RIA Services

Download

Right click “Save as…”

In this video, John meets with Deepesh Mohnani from the WCF RIA Services team. Deepesh demonstrates how to expose various endpoints from WCF RIA Services. This is a great explanation and walk through of how to open RIA Services domain services to clients, including:

  • Silverlight clients (of course)
  • Creating an OData endpoint and showing how Excel can use it
  • Creating a SOAP endpoint to a domain service and using it from a Windows Phone 7 application
  • Creating a JSON endpoint and having an AJAX application talk to it

Relevant links:

Follow us on Twitter @SilverlightTV or on the web at http://silverlight.tv/

Tags:

Follow the Discussion

  • You can find the source code here :- http://blogs.msdn.com/deepm/archive/2010/05/14/silverlight-tv-episode-26-exposing-soap-json-and-odata-endpoints-from-ria-services.aspx

  • Is it the intention that RIA and WCF Data Services will become one technology in the future? When update support is added, will that leave any unique features of Data Services?

  • Great Video Smiley

     

    Great to know the power of RIA service for WPF, WinForms and especially Win Mobile application. When can we expect the Update support...? any probable date ?

     

     

  • Smitha,

    There is update support for both JSON and SOAP endpoint today.

    Thanks Deepesh

  • This is great, thanks... can you tell me how I then configure all the DataServiceConfiguration properties that I normally would in DataService<T>.InitializeService when using oData in the 'normal' way?

  • When using SOAP to access the WCF methods, the whole idea of passing the objectquery (from ria services client to server) does not work.


    In the Ria Services I have the method :

    public IQueryable<Item> GetItems()

    {

      return this.Context.Items;

    }


    And In my database there are 10 items.

    When executing this in silverlight client like:
    var items = srv.GetItems().Take(5);

    There are only 5 items retrieved from database.


    But when using a normal SOAP call, the method call
    var items = srv.GetItems().Take(5);

    retrieves all 10 items from the database and does a Take(5) on the client only.

    Is this correct ? Is there a way to avoid this?

  • femifemi

    how can i pass parameters to the json endpoint?

  • David Roussetdavrous May the force be with U

    Hello,

     As this is a frequent topic during my customers’ meetings, I’ve used your excellent webcast: “Silverlight TV 26: Exposing SOAP, OData, and JSON Endpoints for RIA Services” as a base to write a series of articles on my blog. The first 4 articles are online :

    1 – Review of the initial application: http://blogs.msdn.com/b/davrous/archive/2010/11/10/how-to-open-a-wcf-ria-services-application-to-other-type-of-clients-review-of-the-initial-application-1-5.aspx 
    2 – How to expose the service as an OData stream consumed by Excel and from a web application built with WebMatrix
    3 – How to expose the service as a “standard” WCF Service used from a WPF application and a Windows Phone 7 application
    4 – How to expose the service as a JSON stream to be used by a HTML5/jQuery web application 
    5 – Step by step procedure to publish this WCF RIA Services application to Windows Azure & SQL Azure

     And I’ll try to write the last one before going on vacation. I’ve got the same articles in French also.

     The main Silverlight application is hosted in Azure here: http://bookclub.cloudapp.net and I’ve just slightly modified the original application to add a viewbox control and some webcam logic while you create a new user.

     The second article uses WebMatrix and its OData helper to connect to the OData feed of WCF RIA Services. I’ve tried also to explain the differences with the OData feed available with WCF Data Services.

     The third article shows simple WPF & Windows Phone 7 clients connected to the SOAP endpoint and handling the authentication cookie.

     The fourth article shows an HTML5/jQuery application displaying the books in a fun way using the Galleriffic jQuery plug-in, some CSS3 and an animation based on <canvas>.You can test it here in IE9 (or Chrome/FF/Opera/Safari) : http://bookclub.cloudapp.net/WCFRIA_jQueryHTML5.html . I’m also talking about the way to add/delete items with the JSON endpoint.

    Enjoy !

    David Rousset

  • Shouldn't you just be able to expose the methods via the standard decoration of the method like in a regular WCF service?

    For example:


    Create contract: IAdventureWorks.cs

    [ServiceContract()]
    public interface IAdventureWorks
    {
    [OperationContract()]
    IQueryable<Product> GetProducts(); [OperationContract()]
     Product GetProduct(int id);
    }
    
    

    Implement in your DomainService and decorate method with WebGet(..) : AdventureWorks.cs

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class AdventureWorksService : LinqToEntitiesDomainService<AdventureWorksEntities>, IAdventureWorks
    {
    
      [WebGet(UriTemplate = "Products", ResponseFormat = WebMessageFormat.Xml)]
      public IQueryable<Product> GetProducts()
      {
       return this.ObjectContext.Products;
      }  [WebGet(UriTemplate = "Products?id={0}", ResponseFormat = WebMessageFormat.Xml)]
      public Product GetProduct(int id)
      {
       return this.ObjectContext.Products.Where(p => p.ProductID == id).FirstOrDefault();  }
    }
    
    


     

    Add .svc to Web Project : AdventureWorksExtService.svc

    <%@ ServiceHost Service="ServiceExample.Web.Services.AdventureWorksService"%>
    
    

    Add necessary config settings to web.config.

     

    I realize that is not the case, but would follow the conventions that WCF has establiished outside of RIA.  Future addition?

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.