JSON, REST, SOAP, WSDL, and SOA: How do they all link together

后端 未结 2 1438
鱼传尺愫
鱼传尺愫 2020-12-02 03:39

Currently doing some exams and I\'m struggling through some concepts. These have all been \'mentioned\' in my notes really but I didn\'t really understand how they all linke

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 03:54

    WSDL: Stands for Web Service Description Language

    In SOAP(simple object access protocol), when you use web service and add a web service to your project, your client application(s) doesn't know about web service Functions. Nowadays it's somehow old-fashion and for each kind of different client you have to implement different WSDL files. For example you cannot use same file for .Net and php client. The WSDL file has some descriptions about web service functions. The type of this file is XML. SOAP is an alternative for REST.

    REST: Stands for Representational State Transfer

    It is another kind of API service, it is really easy to use for clients. They do not need to have special file extension like WSDL files. The CRUD operation can be implemented by different HTTP Verbs(GET for Reading, POST for Creation, PUT or PATCH for Updating and DELETE for Deleting the desired document) , They are based on HTTP protocol and most of times the response is in JSON or XML format. On the other hand the client application have to exactly call the related HTTP Verb via exact parameters names and types. Due to not having special file for definition, like WSDL, it is a manually job using the endpoint. But it is not a big deal because now we have a lot of plugins for different IDEs to generating the client-side implementation.

    SOA: Stands for Service Oriented Architecture

    Includes all of the programming with web services concepts and architecture. Imagine that you want to implement a large-scale application. One practice can be having some different services, called micro-services and the whole application mechanism would be calling needed web service at the right time. Both REST and SOAP web services are kind of SOA.

    JSON: Stands for javascript Object Notation

    when you serialize an object for javascript the type of object format is JSON. imagine that you have the human class :

    class Human{
     string Name;
     string Family;
     int Age;
    }
    

    and you have some instances from this class :

    Human h1 = new Human(){
      Name='Saman',
      Family='Gholami',
      Age=26
    }
    

    when you serialize the h1 object to JSON the result is :

      [h1:{Name:'saman',Family:'Gholami',Age:'26'}, ...]
    

    javascript can evaluate this format by eval() function and make an associative array from this JSON string. This one is different concept in comparison to other concepts I described formerly.

提交回复
热议问题