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 linked together. As far as my understanding is:
目前我正在做一些考试,我正在努力理解一些概念。这些都在我的笔记中被提到过,但我真的不明白它们是如何联系在一起的。就我的理解而言:
SOA - a solution to make service consumers/providers communicate. (as far as I understand this is the umbrella term for everything else)
SOA——使服务使用者/提供者进行通信的解决方案。(据我所知,这是其他一切的总称)
WSDL - A language that describes the provider service.
WSDL——描述提供者服务的语言。
SOAP - A XML protocol 'wrapper' used by the services to send messages. Works in conjunction with WSDL as to provide parameters?
SOAP——服务用来发送消息的XML协议“包装器”。与WSDL协同工作以提供参数?
REST - A design pattern that is similar to SOAP in function but avoids the XML? (really not sure about this one)
REST——一种类似于SOAP的设计模式,但避免了XML?(真的不确定)
JSON - An alternative to XML that uses javascript? (not sure about this one either)
JSON——使用javascript的XML的替代品?(这个也不确定)
Looking around in the internet there doesn't seem to be a clear definition of what all of these are and how they interlink.
环顾互联网,似乎并没有一个清晰的定义来定义所有这些是什么以及它们是如何相互联系的。
2 个解决方案
#1
243
Imagine you are developing a web-application and you decide to decouple the functionality from the presentation of the application, because it affords greater freedom.
假设您正在开发一个web应用程序,并决定将功能与应用程序的表示分离开来,因为它提供了更大的*度。
You create an API and let others implement their own front-ends over it as well. What you just did here is implement an SOA methodology, i.e. using web-services.
您可以创建一个API,并让其他人在其上实现自己的前端。您在这里所做的就是实现SOA方法,即使用web服务。
Web services make functional building-blocks accessible over standard Internet protocols independent of platforms and programming languages.
Web服务使功能构建块可以通过标准的Internet协议(独立于平台和编程语言)访问。
So, you design an interchange mechanism between the back-end (web-service) that does the processing and generation of something useful, and the front-end (which consumes the data), which could be anything. (A web, mobile, or desktop application, or another web-service). The only limitation here is that the front-end and back-end must "speak" the same "language".
因此,设计后端(web服务)和前端(使用数据)之间的交换机制,后端(web服务)负责处理和生成有用的东西,而前端(使用数据)可以是任何东西。(web、移动或桌面应用程序或其他web服务)。这里唯一的限制是前端和后端必须“说”相同的“语言”。
That's where SOAP and REST come in. They are standard ways you'd pick communicate with the web-service.
这就是肥皂和休息的用武之地。它们是您选择与web服务进行通信的标准方式。
SOAP:
SOAP:
SOAP internally uses XML to send data back and forth. SOAP messages have rigid structure and the response XML then needs to be parsed. WSDL is a specification of what requests can be made, with which parameters, and what they will return. It is a complete specification of your API.
SOAP内部使用XML来回发送数据。SOAP消息具有刚性结构,然后需要解析响应XML。WSDL是一种规范,说明可以使用哪些参数和它们将返回什么请求。它是您的API的完整规范。
REST:
其他:
REST is a design concept.
REST是一个设计概念。
The World Wide Web represents the largest implementation of a system conforming to the REST architectural style.
万维网代表了符合REST架构风格的系统的最大实现。
It isn't as rigid as SOAP. RESTful web-services use standard URIs and methods to make calls to the webservice. When you request a URI, it returns the representation of an object, that you can then perform operations upon (e.g. GET, PUT, POST, DELETE). You are not limited to picking XML to represent data, you could pick anything really (JSON included)
它没有肥皂那么硬。RESTful web服务使用标准uri和方法调用web服务。当您请求一个URI时,它返回对象的表示,然后您可以对其执行操作(例如GET、PUT、POST、DELETE)。您不仅可以选择XML来表示数据,还可以选择任何东西(包括JSON)
Flickr's REST API goes further and lets you return images as well.
Flickr的REST API更进一步,允许您返回图像。
JSON and XML, are functionally equivalent, and either could be chosen. XML is thought of as being too verbose, and harder to parse, so many-a-times, data is more adequately represented using JSON. (E.g. serialization)
JSON和XML在功能上是等价的,两者都可以选择。XML被认为过于冗长,很难解析,因此,使用JSON可以更充分地表示数据。(如序列化)
尽管如此,这仍是一种选择。
#2
25
WSDL: Stands for Web Service Description Language
表示Web服务描述语言。
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
.
在SOAP(简单对象访问协议)中,当您使用web服务并向您的项目添加web服务时,您的客户端应用程序不知道web服务功能。现在,它有点过时了,对于每种不同的客户端,您必须实现不同的WSDL文件。例如,不能对. net和php客户端使用相同的文件。WSDL文件有一些关于web服务功能的描述。这个文件的类型是XML。肥皂是休息的替代品。
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 HTML
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.
它是另一种API服务,对于客户端非常容易使用。它们不需要像WSDL文件那样有特殊的文件扩展名。CRUD操作可以由不同的HTTP动词实现(读取、创建POST、更新或删除所需文档的PUT或PATCH),它们基于HTML协议,大多数时候响应是JSON或XML格式。另一方面,客户端应用程序必须通过精确的参数名称和类型准确地调用相关的HTTP谓词。由于没有定义的特殊文件(如WSDL),这是一个使用端点的手工作业。但这并不是什么大问题,因为现在我们有很多不同ide的插件来生成客户端实现。
SOA: Stands for Service Oriented Architecture
SOA:代表面向服务的体系结构
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
.
包含所有使用web服务概念和体系结构的编程。假设您希望实现一个大型应用程序。一种实践是拥有一些不同的服务,称为微服务,整个应用程序机制将在正确的时间调用所需的web服务。REST和SOAP web服务都属于某种SOA。
JSON: Stands for javascript Object Notation
JSON:表示javascript对象表示法
when you serialize an object for javascript the type of object format is JSON. imagine that you have the human class :
当为javascript序列化对象时,对象格式的类型是JSON。假设你有一个人类阶层:
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对象序列化为JSON时,结果是:
[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.
javascript可以通过eval()函数来评估这种格式,并从这个JSON字符串创建一个关联数组。与我之前描述的其他概念相比,这个概念是不同的。
#1
243
Imagine you are developing a web-application and you decide to decouple the functionality from the presentation of the application, because it affords greater freedom.
假设您正在开发一个web应用程序,并决定将功能与应用程序的表示分离开来,因为它提供了更大的*度。
You create an API and let others implement their own front-ends over it as well. What you just did here is implement an SOA methodology, i.e. using web-services.
您可以创建一个API,并让其他人在其上实现自己的前端。您在这里所做的就是实现SOA方法,即使用web服务。
Web services make functional building-blocks accessible over standard Internet protocols independent of platforms and programming languages.
Web服务使功能构建块可以通过标准的Internet协议(独立于平台和编程语言)访问。
So, you design an interchange mechanism between the back-end (web-service) that does the processing and generation of something useful, and the front-end (which consumes the data), which could be anything. (A web, mobile, or desktop application, or another web-service). The only limitation here is that the front-end and back-end must "speak" the same "language".
因此,设计后端(web服务)和前端(使用数据)之间的交换机制,后端(web服务)负责处理和生成有用的东西,而前端(使用数据)可以是任何东西。(web、移动或桌面应用程序或其他web服务)。这里唯一的限制是前端和后端必须“说”相同的“语言”。
That's where SOAP and REST come in. They are standard ways you'd pick communicate with the web-service.
这就是肥皂和休息的用武之地。它们是您选择与web服务进行通信的标准方式。
SOAP:
SOAP:
SOAP internally uses XML to send data back and forth. SOAP messages have rigid structure and the response XML then needs to be parsed. WSDL is a specification of what requests can be made, with which parameters, and what they will return. It is a complete specification of your API.
SOAP内部使用XML来回发送数据。SOAP消息具有刚性结构,然后需要解析响应XML。WSDL是一种规范,说明可以使用哪些参数和它们将返回什么请求。它是您的API的完整规范。
REST:
其他:
REST is a design concept.
REST是一个设计概念。
The World Wide Web represents the largest implementation of a system conforming to the REST architectural style.
万维网代表了符合REST架构风格的系统的最大实现。
It isn't as rigid as SOAP. RESTful web-services use standard URIs and methods to make calls to the webservice. When you request a URI, it returns the representation of an object, that you can then perform operations upon (e.g. GET, PUT, POST, DELETE). You are not limited to picking XML to represent data, you could pick anything really (JSON included)
它没有肥皂那么硬。RESTful web服务使用标准uri和方法调用web服务。当您请求一个URI时,它返回对象的表示,然后您可以对其执行操作(例如GET、PUT、POST、DELETE)。您不仅可以选择XML来表示数据,还可以选择任何东西(包括JSON)
Flickr's REST API goes further and lets you return images as well.
Flickr的REST API更进一步,允许您返回图像。
JSON and XML, are functionally equivalent, and either could be chosen. XML is thought of as being too verbose, and harder to parse, so many-a-times, data is more adequately represented using JSON. (E.g. serialization)
JSON和XML在功能上是等价的,两者都可以选择。XML被认为过于冗长,很难解析,因此,使用JSON可以更充分地表示数据。(如序列化)
尽管如此,这仍是一种选择。
#2
25
WSDL: Stands for Web Service Description Language
表示Web服务描述语言。
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
.
在SOAP(简单对象访问协议)中,当您使用web服务并向您的项目添加web服务时,您的客户端应用程序不知道web服务功能。现在,它有点过时了,对于每种不同的客户端,您必须实现不同的WSDL文件。例如,不能对. net和php客户端使用相同的文件。WSDL文件有一些关于web服务功能的描述。这个文件的类型是XML。肥皂是休息的替代品。
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 HTML
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.
它是另一种API服务,对于客户端非常容易使用。它们不需要像WSDL文件那样有特殊的文件扩展名。CRUD操作可以由不同的HTTP动词实现(读取、创建POST、更新或删除所需文档的PUT或PATCH),它们基于HTML协议,大多数时候响应是JSON或XML格式。另一方面,客户端应用程序必须通过精确的参数名称和类型准确地调用相关的HTTP谓词。由于没有定义的特殊文件(如WSDL),这是一个使用端点的手工作业。但这并不是什么大问题,因为现在我们有很多不同ide的插件来生成客户端实现。
SOA: Stands for Service Oriented Architecture
SOA:代表面向服务的体系结构
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
.
包含所有使用web服务概念和体系结构的编程。假设您希望实现一个大型应用程序。一种实践是拥有一些不同的服务,称为微服务,整个应用程序机制将在正确的时间调用所需的web服务。REST和SOAP web服务都属于某种SOA。
JSON: Stands for javascript Object Notation
JSON:表示javascript对象表示法
when you serialize an object for javascript the type of object format is JSON. imagine that you have the human class :
当为javascript序列化对象时,对象格式的类型是JSON。假设你有一个人类阶层:
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对象序列化为JSON时,结果是:
[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.
javascript可以通过eval()函数来评估这种格式,并从这个JSON字符串创建一个关联数组。与我之前描述的其他概念相比,这个概念是不同的。