Why prefer REST over SOAP?

后端 未结 4 897
终归单人心
终归单人心 2021-02-14 04:15

If I need a web service to pass back and forth a complex object, is there a reason I should prefer SOAP over REST? Here is an example of the possible SOAP message:



        
4条回答
  •  半阙折子戏
    2021-02-14 05:06

    I view SOAP and REST as orthogonal APIs, designed to do different things.

    SOAP is basically a fancy RPC, so if you want to send a computation request over to the server and get the result back, you use SOAP. If it would be local, it would be a method call to an object instance.

    REST is a way to create, retrieve, update and delete remote objects, not in the sense of POO, using a uniform API. If it would be local, it would be like working with a file.

    So they actually respond to different needs. You can bastardize one to do the work of the other, but you mangle the meanings.

提交回复
热议问题