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

Similar Messages

  • 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.

  • 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.

  • 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 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.

  • How to create activity workflow based on the Web API 2 services

    Hi,
    We have Web API 2 services and we want create activity workflow based on the Web API 2 services.
    Web API 2 services provide some application operations and based on this operations we would like to create custom activity workflow.
    Question:
    Is that possible?
    Could you please give best practices to create activity workflow based on the Web API 2 services ?
    Thanks for your support.

    HI Max_P,
    Welcome to workflow forum.
    ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.
    I researched relevant topic about creating workflow application using Web API 2, I just found these resources about it.
    Learn About ASP.NET Web API
    Hope it helps.
    Best regards,
    Angie
    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 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

  • 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.

  • 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.

  • WCF vs Web API, Deeper details?

    Before I continue, I just want to mention I have heavily researched and searched on this topic, but I need the opinion of people who have worked/and or have practical knowledge with
    regards to this topic.
    We are currently looking at developing an API so that clients can utilize this. We are definitely set on REST as opposed to SOAP, but I am still a little unclear about what exactly the difference is, if you go down to microscopic detail.
    Having a look at msdn (Choosing which technology to use), the link below:
    http://msdn.microsoft.com/en-us/library/jj823172.aspx
    The differences are clear. However, the first point states for WCF:
    Enables building services that support multiple transport protocols (HTTP, TCP, UDP, and custom transports) and allows switching between them.
    For ASP.NET Web Api:
    HTTP only. First-class programming model for HTTP. More suitable for access from various browsers, mobile devices etc enabling wide reach.
    So, both support HTTP, but WCF supports more protocols in addition. What makes ASP.NET Web API more suitable for, I quote: "More suitable for access from various browsers, mobile devices etc enabling wide reach." if both support HTTP?
    We have until now, relied heavily on PC use. What I am getting to, and finally my question is:
    We plan on going mobile, and moving a lot more to multiple devices, browsers etc. But I just would not like to go on a service on the basis of a bit of text saying "Web API" is more suitable? IS it more efficient, less resource intensive etc.? With
    regards to future proofing? Would we be better of with WEB API and why? Just lastly, we have existing SOAP services, everything we have is built in SOAP.
    Please do not hesitate to go into detail, I am not an experienced dev, just trying to add a contribution to this project.
    Just a last couple of requirements:
    1) We plan on utilizing JSON. 2) We are limited to .NET 3.5/4. 3) Must be REST.

    Its all hype for the different products written by different product teams with incentive to get their baby adopted. Ignore them all and evaluate what you need, not what they need you to want.
    What I do know if that ASP.NET projects require a heap of infrastructure (eg IIS, and associated configuration), whereas WCF can be built as stand-alone services that just run with minimal configuration (typically registering the root URL with http.sys).
    This is the biggest win for me - recently we had some older ASP.NET projects that we had to integrate with, and what could have been an easy task with some WCF services was a huge PiTA as we had to go through a mass of setup instructions (that were not necessarily
    up to date, of course) to get something working, not to mention the installation of system services to do this.
    So you need to consider the future maintenance involved. If WebAPI requires a heap of setup, then I'd avoid it.
    There are alternatives, WWS is much more efficient as WCF and supports the same protocols (not that it matters if you're only using HTTP). If you are just building a REST API then any web server, embedded or not, will do. (eg I added Mongoose to one of my
    services recently, so now it serves http to clients as well, seamlessly and really simple though using C++ not C#).

  • 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.

Maybe you are looking for

  • HP LaserJet M5035 MFP - Domain authentication - Mac OS 10.6.3

    Hi, I am using HP LaserJet M5035 MFP and there were many discussions about this. However, I am facing a new problem that I am using a domain authentication. So the smb syntax: smb://username:password@workgroup/server/sharename does not work with me.

  • JavaCode to create IT Resource, Group and UserForm in OIM

    Hi, Is it possible to create the ITResource, Group and UserForm in OIM using java code(java apis). Has anyone tried creating. Regards, Manju

  • Safari not loading html formatting correctly

    I have updated the a website that has or tags and the text does not appear as bold in Safari 4.0.3. Shows properly in Firefox and Navigator. Does anyone know why this might be? Thanks for any help. Rich

  • Getting java.lang.OutOfMemoryError when deploying

    Hi, I have an ear-file which is not very big, 12Mb, but when I run deploy from Enterprise Manager I get the following error: [2007-maj-09 10:09:50] Binding XXPA_PA140 web-module for application XXPA_PA140 to site default-web-site under context root X

  • Compounding consistency for InfoObject 0PERSIDNO not ensured

    Hi, When i am creating multiprovider i am getting error message."Compounding consistency for InfoObject 0PERSIDNO not ensured". In one of the affected InfoProviders, InfoObject 0PERSIDNO is compounded with InfoObject 0COUNTRY_ID. 0PERSIDNO is mapped