WCF Rest Service

Hi,
What the difference betwwen the wcf rest service and web api? When to choose to use the web api?

Hi Andrewsys,
>>What the difference betwwen the wcf rest service and web api?
For the difference betwwen the WCF Rest Service and Web API, please try to refer to the following information:
WCF Rest Service:
To use WCF as WCF
Rest service you have to enable webHttpBindings.
It support HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively.
To enable other HTTP verbs you have to do some configuration in IIS to accept request of that particular verb on .svc files
Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified
It support XML, JSON and ATOM data format.
Web API:
This is the new framework for building HTTP services with easy and simple way.
Web API is open source an ideal platform for building REST-ful services over the .NET Framework.
Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats)
It also supports the MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing that makes it more simple and robust.
It can be hosted with in the application or on IIS.
It is light weight architecture and good for devices which have limited bandwidth like smart phones.
Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter.
>>When to choose to use the web api?
Choose Web API when you want to create a resource-oriented services over HTTP that can use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).
Choose Web API when you want to expose your service to a broad range of clients including browsers, mobiles, iphone and tablets.
For more information, please try to refer to the following articles:
https://msdn.microsoft.com/en-us/library/jj823172(v=vs.110).aspx .
http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-REST-and-Web-Service.html
http://blogs.msdn.com/b/fkaduk/archive/2014/01/07/rest-wcf-vs-webapi-throughput.aspx .
Best Regards,
Amy Peng
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Getting Excel to interpret the return string of a WEBSERVICE() function using a WCF REST service.

    I am using the WEBSERVICE() function in Excel and a WCF REST service is called through this function.  
    The web service returns a string value of true or false when invoked.  E.g. <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">True</string>
    This has been confirmed through debugging and it seems to be working fine when invoked through a client application or browser.
    However, the result shown in the cell in the Excel sheet is #VALUE!. This particular cell has a custom format (set using the Format Cells ... option) that displays "Yes" or "No". (The
    custom format is "Yes" ; "Yes" ; "No".)  Is this the correct way of interpreting the results of a Web Service method called in Excel? Does a #VALUE! result actually imply a formatting issue or some other interpretation
    error? Is there anything missing? Can somebody suggest ideas?
    Any help would be appreciated.
    Many thanks,
    Keith
    R K Howard

    Hi Keith,
    Have you used the formula FILTERXML(xml, xpath) function to extract single pieces of data from the XML string?
    If not, please follow the blog below, the author will guide you to get data from Webservice.
    http://blogs.office.com/2013/03/21/use-webservice-functions-to-automatically-update-excel-2013-spreadsheets-with-online-data/
    Best Regards
    Lan 
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • WCF and WP8.1: Can I only use WCF REST services? Then better WCF or Web API?

    I am trying to create a simple application to test WCF with WP8.1. I have created my service. Later I create my WP8.1 silver light application and I try to add a reference to my service Project. The problem is that I get an error that says that I have only
    add reference to projects that are Windows pone 8.
    I have read some solutions, but all of them are creating a WCF REST service, so my doubt if the WP8.1 applications only can connect to WCF REST services.
    In this case, if this is true, it not would be better to use Web API instead of WCF?
    Thanks so much.

    You can use any type of rest service with windows phone 8.1 because rest services can be called via the httpclient class.  You dont need a service reference.  Personally I prefer the web api but there is no reason you can not use a wcf rest service.

  • WCF Rest Service Vs Web API

    1. What is difference between WCF REST SERVICE(and not WCF) and WebAPI?
    2. When we should one over another?
    Deepak Talele Ph: 91-9158413830 Email: [email protected], [email protected]

    Hi,
    Use WCF to create reliable, secure web services that accessible over a variety of transports. Use ASP.NET Web API to create HTTP-based services that are accessible from a wide variety of clients. Use ASP.NET Web API if you are creating and designing new
    REST-style services. Although WCF provides some support for writing REST-style services, the support for REST in ASP.NET Web API is more complete and all future REST feature improvements will be made in ASP.NET Web API.
    For the difference between WCF REST Service and web api, you could refer to the following links for more information:
    https://msdn.microsoft.com/en-us/library/jj823172(v=vs.110).aspx
    http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-REST-and-Web-Service.html
    Regards

  • WCF rest services STS and JavaScript

    Hello
    I want to have rest services that are claims enabled, the token should be issued by the STS after the user log in to the web app. This token shall be saved and used by JavaScript calls to the rest services. Is this possible? if so kindly provide a sample
    or explanation, since I have been through a lot of examples for STS and rest and trying to build this scenario but it seems very complex. I have spent a lot of time on this.
    Thank you in advance
    Regards,
    Moe

    Hi Don Hamdan,
    >>I want to have rest services that are claims enabled, the token should be issued by the STS after the user log in to the web app. This token shall be saved and used by JavaScript calls to the rest services. Is this possible?
    Yes, it is possible, I will recommand you build the claims enabled WCF Services using WIF, the following is the scenario of it:
    In this way the client will use the WIF to send credentials to the STS and upon successful authentication, the agent is issued a token by the STS and the agent sends this STS-issued token to the WCF service.The claims enabled WCF service is configured
    to trust the STS and the tokens it issues. Besides, the claims enabled WCF service uses WIF to validate the token and to parse it.
    For more information, please try to refer to the following article:
    #Understanding Windows Identity Foundation (WIF) 4.5:
    http://www.codeproject.com/Articles/504399/Understanding-Windows-Identity-Foundation-WIF .  
    #Using WIF for securing REST Service:
    http://zamd.net/2010/07/31/using-wif-for-securing-rest-service/ .
    #Secure your REST-based WCF service with WIF:
    https://waysec.wordpress.com/2011/12/28/secure-your-rest-based-wcf-service-with-wif-part-1/ .
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Unable to deploy a simple WCF REST service on IIS

    Hi,
    I have create a simple WCF based REST service in VS. I am able to run this in VS while deploying it in IIS 8.5 is really difficult. I am not able to do this. Everytime IIS gives 500 error and gives possible errors but not the actual one. Is there any document
    for web service (REST based WCF) deployment on IIS 8.5 which I can refer to.
    Regards,
    UmeshB

    Check if the below articles helps-
    RESTful WCF Architecture
    – Hosting RESTful WCF Services in IIS
    Walkthrough on creating WCF 4.0 Service and Hosting
    Also, where is BizTalk in your flow?
    Thanks,
    Prashant
    Please mark this post accordingly if it answers your query or is helpful.

  • Problem: Project can't connect to WCF RESTful service in the same solution

    I followed the instruction in "Consuming
    a RESTful web service with jQuery and Ajax" on the blog of Dedra L. Welch and created in my solution a WFC Web Application (RestService)
    and a ASP.NET Empty Website (TestClient), but the client website couldn't connect to the service. I'm not sure did the jQuery function even run at all.

    Hi blue_lightning,
    >>but the client website couldn't connect to the service. I'm not sure did the jQuery function even run at all.
    First please try to follow the blog step by step to see if it works.
    Then please try to use the fiddler to help you detect if the service is run or not. Or you can just use a Get method in your web service to test if you can broswer it in the broswer. If you can get the right value with the Get method, then it means
    that your service should run.
    #Fiddler:
    http://www.telerik.com/fiddler .
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Rest services using WCF

    Hi,
    Couple of doubts about wcf rest  services.
    1, how a wcf rest service call is made from a asp.net mvc or asp.net web application .
     a, What is the better way to consume in ecommerce application (where traffic is more)
    b, is it using a httpwebrequest obejct or do we need to create a proxy class , can anybody paste a snippet of the code
    consume it ore please suggest a web reference link .
    2, is the web api took over the wcf rest service role  or still it is using in industry.
    Thanks

    Hi techasuran,
    >>1, how a wcf rest service call is made from a asp.net mvc or asp.net web application .
    a,What is the better way to consume in ecommerce application (where traffic is more)
    b, is it using a httpwebrequest obejct or do we need to create a proxy class , can anybody paste a snippet of the code
    For the WCF Rest Service, we can not do the add the service reference as do in WCF SOAP Service, because the REST Service has no concept of a WSDL in WCF. Then if you want to call the WCF Rest Service from a asp.net mvc or asp.net
    web application, please try to use the HttpWebReqest, HttpClient or the Jquery to help us. In my mind the better way to consume the WCF Rest Services in the ecommerce application is to use the Jquery Ajax Calls.
    For more information, please try to refer to the following articles:
    #Call Restful Service using HttpWebRequest:
    http://fromjami.wordpress.com/2013/05/26/call-restful-service-using-httpwebrequest-and-post-data/ .
    #Create and consume WCF Restful Service using an HttpClient:
    http://chsakell.com/2013/07/12/create-and-consume-wcf-restful-service-using-an-httpclient/ .
    #Consume RESTful service using jQuery in 2 simple steps:
    http://www.topwcftutorials.net/2013/10/consume-rest-service-using-jquery.html .
    >>2, is the web api took over the wcf rest service role  or still it is using in industry.
    Web API is open source an ideal platform for building REST-ful services over the .NET Framework. Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats). It also supports the
    MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing that makes it more simple and robust.
    For more information about the difference betwwen the WCF Rest Service and Web API and how to choose betwwen them, please try to refer to the following articles:
    #Difference between WCF and Web API and WCF REST and Web Service:
    http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-REST-and-Web-Service.html
    #WCF or ASP.NET Web APIs:
    http://www.codeproject.com/Articles/341414/WCF-or-ASP-NET-Web-APIs-My-two-cents-on-the-subjec .
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Flex and Restful Services

    Hello,
    I'm new to the whole Flex system and I'm trying to integrate with WCF Rest Services
    I see that Flex doesn't support PUT and DELETE which is fine because we can use the x-http-method-override header which I assume you set in Flex with the headers property of the HttpService object?
    httpService.headers["x-http-method-override"] = "DELETE"
    The other thing is the HTTP Status code - it seems that Flex can't give you the HTTP Status code returned by the HttpService and that codes over 200 cause an exception. Is this correct and is this going to be resolved in Flex 4?
    Thanks,
    Dave

    I had a similar problem with 302 codes.  Firefox gets HTTPStatusEvent.HTTP_STATUS and IE gets Event.COMPLETE.  Can you check HTTPStatusEvent in Safari?
    Basically the HTTP stuff is a total disaster because of all the inconsistencies in the browser plug-in interfaces.  So much for "write once run anywhere"!  More like write once, test everywhere, pray...
    If you're in control of the server returning the 204 I'd say change it to not do that but I understand that may not be an option.

  • How to Create simple WCF/REST (JOSN,get and post) and deploy to Sharepoint 2013 Server.

    HI All,
       I wan to create a simple WCF/REST service and deployed to SharePoint server , i have created some sample svc file and put in to _vti_bin folder using SharePoint solution using vs 2013 but its not accessible from IIS its always asking the Widows
    Authentcation .
    however my exact requirement is custom service should be accessible without asking the authentication like _vti_bin/Listdata.svc is there any way to do like this ? 
    my reference:
    http://platinumdogs.me/2013/03/14/sharepoint-adventures-with-the-rest-api-part-1/
    http://msdn.microsoft.com/en-us/library/office/jj860569(v=office.15).aspx
    http://dotnetmentors.com/wcf/wcf-rest-service-to-get-or-post-json-data-and-retrieve-json-data-with-datacontract.aspx
    http://stevenhollidge.blogspot.in/2011/09/wcfwebapi-rest-json-services.html
    Thanks
    SujilKumar
    Software developer

    Hi Sujil
    Greetings. pls check this link
    http://social.technet.microsoft.com/wiki/contents/articles/24194.sharepoint-2013-create-a-custom-wcf-rest-service-hosted-in-sharepoint-and-deployed-in-a-wsp.aspx
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • WCF Rest Windows Phone

    Hello,
    I am new. I wants to know how to call WCF Rest Service from Windows Phone 8.1 Runtime app.

    Hi Hellotesttest,
    We can use the
    HttpClient class to help us cosume the WCF Rest Service from the Windows Phone 8.1 Runtime app.
    For example you have this ServiceContract in your WCF Rest Service:
    [ServiceContract]
    public interface IService1
    [OperationContract]
    [WebGet(UriTemplate = "Test")]
    string Test();
    Then in Windows Phone you can use this code to consume the WCF Rest Service:
    private async void Test()
    HttpClient MyHttpClient = new HttpClient();
    HttpRequestMessage MyRequest = new HttpRequestMessage(HttpMethod.Get, http://******/Service1.svc/Test);
    HttpResponseMessage MyResponse = await MyHttpClient.SendAsync(MyRequest);
    string MyData = await MyResponse.Content.ReadAsStringAsync();
    MessageDialo MyDialog = new MessageDialog(MyData);
    await MyDialog.ShowAsync();
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Java REST Services  !

    hi,
    how can we write java REST webservice ? we basically have a wcf rest service and we would like to shift it to java .
    any suggestion/tutorials you would suggest .
    P.S
    we are only familiar with j2se .

    any body , who know how to program a service on wcf and java should be an ideal person to answer this post .
    I am currently stuck on this issue of conversion . Does Java provide an (Server.Execute and Server.Transfer )implementation like Microsoft does . Server.Execute processes the .aspx file we give as parameter and return the html returned as a response to the incoming request .
    and Server.transfer transfer the client to the other page by returning an Http 302 (moved temporarily ) response to the client and thus client gets redirected to the other page . it also takes a page url parameter.
    i hope i get the steps as well as answer to the above question soon.
    thanks
    Jamal.

  • Rest Service method called twice in wcf

    Hi all,
    I have created a rest service using wcf.
    I am writing Entity framework code within a service method to fetch data from database.
    Every call from browser is hitting the service method twice or thrice.
    I found no exception within the method. I encountered same problem before and solved it adding DataContract attribute to all the models(not helping now).
    What may be the possible reasons? Please help.
    Regards
    Ashish

    Hi,
    I want to know if you are using the WebGet (Http GET). If so, please try to change that API to WebInvoke (Http POST).
    Because IIS has some setting for HTTP GET as 40sec replay, so if within 40sec the server does not get response, then it will query itself again. Then it will be called twice or more.
    For more information, please try to refer to:
    #RESTful API in WCF get called more than one time:
    http://www.codeproject.com/Tips/338142/RESTful-API-in-WCF-get-called-more-than-one-time-b .
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to POST the data though Rest services though composite object.

    I am new to REST services.
    I need to write REST Serivices to post(Update) the data using Composite object.
    I created the structure to pass the composite object from jquery to the REST services.
    How can i handle that composite object in REST Services URITemplate and interface methods.
    can i have sample code to handle the composite object in REST Services?
    Thanks in advance.

    Did you check this post?
    http://sharepoint.stackexchange.com/questions/25222/posting-json-to-a-rest-wcf-endpoint-in-sharepoint-using-cksdev
    --Cheers

  • WCF Data Service from Entity Framework 5 in SharePoint 2013

    not sure which forum is best, so im going to throw it in here.
    I am working on a proof of concept. I want to create a WCF Data Service within sharepoint 2013. not only do i want to do that, i want to use the Entity Framework 5 to expose the data via OData. Now, I have crawled the internet and seen various examples of
    how to create wcf data services and wcf services in sharepoint 2010/2013. and have tried to apply those as needed to create this POC. So.. what I have done so far. 
    MonitoringData.cs
    [BasicHttpBindingServiceMetadataExchangeEndpoint]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    [System.Runtime.InteropServices.Guid("0185abf6-e8b8-42e2-9965-6bb644338077")]
    public class MonitoringData : DataService<MonitoringServiceEntities>
    // This method is called only once to initialize service-wide policies.
    public static void InitializeService(DataServiceConfiguration config)
    // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
    // Examples:
    config.SetEntitySetAccessRule("*", EntitySetRights.AllWrite);
    config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
    config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
    MonitoringData.svc:
    <%@ServiceHost Language="C#" Debug="true"
    Service="$SharePoint.Type.0185abf6-e8b8-42e2-9965-6bb644338077.AssemblyQualifiedName$"
    Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressDataServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    upon deployment, this error when hitting the https://server/_vti_bin/poc/monitoringdata.svc/$metadata
    "The type 'xxxxxxxx', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could
    not be found."
    Breaking out the google-fu, i found that adding the dll to the <compilation> section was needed for the web.config. so i did that. and now i just get a blank screen with no errors.
    so i crack open fiddler. i see the following 
    200 http
    tunnel to
    server:443 0
    401 https
    server /_vti_bin/poc/monitoringdata.svc/$metadata
    16
    401
    https server
    /_vti_bin/poc/monitoringdata.svc/$metadata
    0
    404
    https server
    /_vti_bin/poc/monitoringdata.svc/$metadata
    0
    best i can see is that im either not authorized, and its returning null (which shouldnt be the case) or something is just busted.
    The goal is to use ntml auth and https to connect to this service. any ideas?

    One thing I found was that it's never worth the trouble to place the WCF service in a web site running SharePoint, it's better to place it in a dedicated web site, as described in this article:
    http://sharepointdragons.com/2011/10/07/parallel-programming-in-sharepoint-2010-the-back-to-the-future-pattern/
    It's usually too much work to get the web.config settings right because of the settings it inherits from its parents.
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com
    I'll say that it is one solution to move the WCF Service outside of sharepoint. but my "1000 mile" requirements makes this a necessity. 
    To broaden the scope of what I am doing, I have a custom SharePoint Service Application. this custom application has a proxy that used a restful interface. Now, with all the methods i will have to write (over 100, x3 for all of the "proxy to a proxy" scenarios)
    I wanted to explore the idea of using odata. so i can use the various clients to write their own queries instead of me writing them all and exposing them. especially since its all linq queries to a database underneath. I feel that I am missing some specific
    component to make this work, and its surely due to my incomplete knowledge of WCF or EF.

Maybe you are looking for