How to understand and start a rest service or soap [duplicate]

0

I still can not look at a web service and say if it is REST or SOAP . The question is:

  • When to use one or the other
  • How to differentiate when viewing the code if it is REST or SOAP
  • Performance between one and another
  • Sometimes I find it difficult to ask questions. Well, then let's go. I arrived at the company now and saw within a project, a web service. There's asmx.cs and asp.net. This web service is within the project. It is an aspx project and I have to rewrite everything using MVC 4 or 5, in my case 5. Well, I thought about keeping the web service running, but since it is together in the same previous project and as I will have to rewrite in MVC, which recreate it within my current project. I will reuse almost everything in it and maybe add something new. Hence the initial question. But I would like to know about you if you have how to get this web service and dismember the current project or this is pure utopia. Should I really rewrite? This is also my doubt.

        
    asked by anonymous 24.04.2014 / 19:41

    1 answer

    5

    A REST webservice is lighter than SOAP because the data traffic structure is generally smaller. This happens because when using SOAP data transfer is done with XML, whereas a REST service usually uses JSON, which is a simpler format.

    In terms of ease of use, a SOAP webservice will be easier to integrate than a REST. This is because SOAP services work on a very well-defined standard that allows the discovery of services, that is, it presents metadata about the services themselves.

    The default allows you to clearly define the parameters and returns of a webservice method, and is able to traffic errors ... is a true remote procedure call (RPC) standard.

    In addition, the SOAP standard has broad support for development tools. This way it is very easy, in any project, to use a webservice based on SOAP, since the tools allow to automatically generate the code to consume such services, creating methods and classes automatically.

    Since a REST webservice is more difficult to use because you would have to encode and decode the messages yourself, and there is no automatic validation of the message format, and there is not even a way to find out what services are available , so you will need to know beforehand what they are.

    REST is not a standard by itself ... it is only a consensus on using the HTTP protocol for API messages, in a representative way, that is, using the verbs and HTTP status in a way that is consistent with the specification. There is, for example, no obligation to use JSON.

        
    24.04.2014 / 19:50