locked
Web API vs Web Service RRS feed

  • Question

  • User-289010069 posted

    I have a request to create a web service or API to allow internal apps to retrieve data from an external API outside of the company.  The internal applications will call the internal Web Service or API in order to retrieve information from the external API.  The external API will return information in XML format.  Is it best to create a web service to call the external API since only XML results will be returned?  Is there any benefit for using a Web API in this scenario? If an API should be used, is there a really simple example available for me to follow?

    Friday, February 26, 2021 1:04 PM

Answers

  • User475983607 posted

    In VS 2010, I would normally create a web service by adding a new item and selecting "Web Service". 

    If I recall, in 2010 you have the choice to create an ASMX or WCF service.  Both are SOAP Web Services.

    Would there be any advantages to using a Web API over a traditional web service

    In VS 2019 you'll need to install WCF.  I'm not sure if ASMX is still available.  The latest version of .NET (.net5.0) does not support WCF.

    For the second time, Web API is a solid choice and what I recommend going forward.  

    Also, I will have to use token based authentication to communicate with the external API.  Not sure if that would matter or not.

    Read the documentation for the token server.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 26, 2021 2:16 PM

All replies

  • User475983607 posted

    Your question is confusing because Web API is a type of web service.  Web API is a REST service.   It does not matter if the external service is SOAP, XML or REST service.  The client that connects to the external service will do so according to the documentation for the external service.  

    Web API is a strong choice.  See the official documentation to learn the basics.

    https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-5.0&tabs=visual-studio

    Friday, February 26, 2021 1:19 PM
  • User-289010069 posted

    Sorry, I will try to explain.  We are primarily using an old version of Visual Studio 2010 develop web applications.  In VS 2010, I would normally create a web service by adding a new item and selecting "Web Service".  I'm also aware of the Web API template that is available in the later versions of Visual Studio with ASP.NET Core.  I was trying to figure out if I should use VS 2010 to create a traditional web service for this project or if I should obtain a newer version of Visual Studio to take advantage of any new features available in the Web API template using ASP.NET Core.  Would there be any advantages to using a Web API over a traditional web service?

    Also, I will have to use token based authentication to communicate with the external API.  Not sure if that would matter or not.

    Friday, February 26, 2021 1:51 PM
  • User475983607 posted

    In VS 2010, I would normally create a web service by adding a new item and selecting "Web Service". 

    If I recall, in 2010 you have the choice to create an ASMX or WCF service.  Both are SOAP Web Services.

    Would there be any advantages to using a Web API over a traditional web service

    In VS 2019 you'll need to install WCF.  I'm not sure if ASMX is still available.  The latest version of .NET (.net5.0) does not support WCF.

    For the second time, Web API is a solid choice and what I recommend going forward.  

    Also, I will have to use token based authentication to communicate with the external API.  Not sure if that would matter or not.

    Read the documentation for the token server.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 26, 2021 2:16 PM
  • User-474980206 posted

    vs 2010 web services are SOAP based. SOAP applications can use a token passed via the header. But the typical token api is REST. you can call a REST api directly with HttpClient. 

    the question really is, who is calling your web service and what technology will they use? will your service use tokens, or are they only used for the external service?

    note: vs 2010 is not supported. not sure why you don't upgrade to the free vs2019 community version. It would a much better experience.

    Friday, February 26, 2021 7:28 PM
  • User-289010069 posted

    Internal VS 2010 applications will call the web service which will be hosted on an internal web server.  The tokens are only used for the external API.

    We plan to upgrade to VS 2019 at some point this year.

    Friday, February 26, 2021 7:36 PM