Web Service vs Web Application

前端 未结 11 561
别跟我提以往
别跟我提以往 2020-12-12 13:13

I know this is an old question and must have been answered hundred times already, but I am not able to find a satisfactory response as yet.

I am creating an applicat

相关标签:
11条回答
  • 2020-12-12 13:31

    I think this might help you in resolving your confusion

    There are two main use cases of WEB in the industry

    1. Business to Consumer(B2C) : Whenever there is consumer directly interacting with the business for its needs we always uses a Web-Application to provide a communication between two parties.
    2. Business to Business(B2B) : It means one part of the business need some input/services from another part of the business. Always a Web-Service is used to meet the business to business requirements. Usually a consumer never interact with the Web-Services directly we only interacts with a Web-Application and a Web-Application interact with a Web-Services for information/data or processing.

    Taken from http://coder2design.com/java-interview-questions/

    0 讨论(0)
  • 2020-12-12 13:36

    At a low level web applications and web services are kinda the same thing. They both operatate over http(s). SOAP is just a well defined version of XML. REST is kinda just HTTP. If you wanted to, you could make a web application look like web services and visa versa.

    The main difference would be internal development options based on the platform you are using. If, for example, you are using Visual Studio then adding a WCF Service Application will give you a project which is by default geared towards WCF. But choosing any other application type won't stop you from adding Web Services.

    Using SOAP is generally a better option than plain old xml for these reasons:

    • Your users will be expecting it, and are likely to know how to read it already.

    • Your users' development environments will likely know all about SOAP and be able to interpret it out of the box. (If you provide a WSDL file then many users will be able to use a script to generate your classes in seconds.)

    • Your messages are more likely to be well defined. I am working on a project at the moment where the other side have defined their own random XML structure and it is a nightmare to work with. I never really know what to expect, and there is little consistency between their different message types. At least if they had agreed to conform to SOAP then I might have had a much easier time interpreting their messages.

    0 讨论(0)
  • 2020-12-12 13:41

    My question is that same can be achieved by a simple web app accepting the request in XML format and responding with an XML response.

    That is a web service. I think this is an issue of terminology. You have no way of solving this other than to use a web service, whether it is restful or SOAP based is up to you but if you are passing data to clients in XML format, in response to XML requests, that is a web service.

    I suspect what you mean to ask is whether or not you should be using a RESTful webservice or a complicated SOAP based approach. For me the answer depends on how many functions are needed in your 'Service'.

    SOAP

    If your service has lots of functions than users of java and/or visual studio would prefer to import your WSDL file and use your service as an object with all of the XML parsing done for them, so SOAP would be the answer.

    REST

    If you only have a few functions, with very basic input parameters and response data, then SOAP might be overkill.

    MySite.com/Add/5/3
    

    or

    MySite.com/GetStockSymbol/Facebook
    

    or

    MySite.com/GetWeather/Paris/France
    
    0 讨论(0)
  • 2020-12-12 13:45

    From RESTful Web Services by Leonard Richardson and Sam Ruby, ISBN: 978-0-596-52926-0:

    Web services are indeed very similar to web applications, but resource creation is one of the places where they differ. The main difference here is that HTML forms currently support only GET and POST. This means web applications must use overloaded POST to convey any unsafe operation.

    0 讨论(0)
  • 2020-12-12 13:46

    I guess the web application vs web service is the fact that the deployment factor ratio vary meaning the deployment of a web application would be limited (locally ) to what as in case of a web service (globally). Plus, When we think of UI perspective better option is the Web application but when we think of programming and data transfer perspective mainly go for a web service. Web application requires use of servlets with frameworks like Spring mvc etc. On the other hand, if you want to deploy the same application to multiple platforms make it a web service via Rest/Soap implementations so that the web applications behaviour gets changed to rather a service.

    In short,

       WebService   =
    
                     (RestApi/Soap)    # added 
                 /         |         \
    (client1)---(Web Application)---(clientN)
    
    0 讨论(0)
  • 2020-12-12 13:46

    This is a simple way to know about it:

    Web Application means for human beign can read. it is accessed through browsers.

    Whereas

    Web Services means for computers can read. it is accessed from any languages or platform.

    For example:

    Yatra.com(Java based services) application communicate Paypal.com(Python based services) application

    0 讨论(0)
提交回复
热议问题