什么是web服务_什么是Web服务?-程序员宅基地

技术标签: python  java  linux  http  php  

什么是web服务

Web Services are client and server applications that communicate over the World Wide Web's (WWW) Hypertext Transfer Protocol (HTTP). As described by the World Wide Web Consortium (W3C), web services provide a standard means of interoperating between software applications running on a variety of platforms and frameworks.

Web服务是通过万维网( WWW )超文本传输​​协议( HTTP )进行通信的客户端和服务器应用程序。 如万维网联盟(W3C)所述,Web服务提供了在各种平台和框架上运行的软件应用程序之间进行互操作的标准方法。

Web Services can be looked as a code on demand. Just like we call functions and methods, web services can be looked upon as calling a function or method over the internet using some sort of protocols and some agreements.

Web服务可以看作是按需代码 。 就像我们调用函数和方法一样,Web服务可以看作是使用某种协议和某些协议通过Internet调用函数或方法。

A web service is a function or method which we can call by sending an HTTP request to a URL, with arguments and the service returns the result back as response.

Web服务是一种函数或方法,可以通过将HTTP请求发送到带有参数的URL来调用该函数或方法,然后该服务将结果作为响应返回。

The biggest advantage of the web services is that it is platform independent.

Web服务的最大优点是它与平台无关。

Introduction to Web Services

Consider the above figure, We can see that the application written in Java can interact with PHP and .net platforms through the web service. Therefore, it is completely platform independent. A web service exposed in the PHP can be consumed by any platform be it java, .net or PHP. This capability of the web service is making it so popular. Therefore, a web service is a language independent way of communication.

考虑上图,我们可以看到用Java编写的应用程序可以通过Web服务与PHP和.net平台进行交互。 因此,它是完全独立于平台的。 PHP公开的Web服务可以被任何平台使用,无论是Java,.net还是PHP。 Web服务的这种功能使其变得如此流行。 因此,Web服务是一种独立于语言的通信方式。

Now let us look at one of the most common use case where web services are being used extensively.

现在,让我们看一下广泛使用Web服务的最常见用例之一。

Consider the figure below, suppose I have made a new cool application but I do not want to maintain the data of the users, who login to my application, but we want only authenticated users to use the application.

考虑下图,假设我已经制作了一个很酷的应用程序,但是我不想维护登录到我的应用程序的用户的数据,但是我们只希望经过身份验证的用户才能使用该应用程序。

So what should we do? One option is, we can use the web services exposed by some other third party application, to authenticate our incoming users. You must have seen this in many applications, in form of - Sign up using Facebook, Google or other third party apps. Many Websites/Apps use Facebook and Google data, using their web services, to authenticate users.

那我们该怎么办? 一种选择是,我们可以使用某些其他第三方应用程序公开的Web服务来验证传入的用户。 你必须在许多应用中已经看到了这一点,在形式- 注册使用Facebook, 谷歌或其他第三方应用。 许多网站/应用程序通过其Web服务使用Facebook和Google数据来验证用户身份。

Therefore, we do not have to maintain any data of the users to authenticate, rather we can now fully concentrate on the content of our application.

因此,我们不必维护用户的任何数据即可进行身份验证,而现在我们可以完全专注于应用程序的内容。

The flow of the authentication process will be like this:

身份验证过程的流程将如下所示:

  1. User logs into our Application.

    用户登录到我们的应用程序。

  2. We show them two options - either sign in using Facebook or Google.

    我们向他们展示了两个选项-使用Facebook或Google登录。

  3. Enter the Username and Password.

    输入用户名和密码。

  4. The application will now pass the Username and Password to Google or Facebook server using http request.

    该应用程序现在将使用http请求将用户名和密码传递给Google或Facebook服务器。

  5. The request/response can be in any format. It could be a json/xml or any other media type.

    请求/响应可以是任何格式。 它可以是json / xml或任何其他媒体类型。

  6. Now if the request is ok, Google or Facebook server will send us the response and accordingly we will authenticate our users to login into the application.

    现在,如果请求正常,Google或Facebook服务器将向我们发送响应,并相应地我们将对用户进行身份验证以登录到该应用程序。

The third party apps, who expose their APIs must provide a proper documentation of all the requests and responses. Checkout this link for the PayPal API to get some idea how documentation is done - https://developer.paypal.com/docs/api/identity/

公开其API的第三方应用程序必须提供所有请求和响应的正确文档。 查看此PayPal API链接以了解如何完成文档制作-https: //developer.paypal.com/docs/api/identity/

Introduction

翻译自: https://www.studytonight.com/rest-web-service/introduction

什么是web服务

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/cunfen6312/article/details/107684232

智能推荐

ubuntu安装虚拟环境_ubuntu xunihuanj-程序员宅基地

文章浏览阅读825次。ubuntu下虚拟环境的安装在开发过程中,当需要使用python的包时可以联网安装sudo pip3 install 包名称----没有pip3则:sudo apt install python-pip3使用如上命令,会将包安装到/usr/local/lib/python3.5/dist-packages下。1 产生的问题如果在一台机器上,想开发多个不同的项目,需要用到同一个包的不同版本,如果还使用上面的命令,在同一个目录下安装或者更新,其它的项目必须就无法运行了,怎么办呢?解决方案_ubuntu xunihuanj

Linux视频学习笔记(九)--yum在线管理、源码包管理与脚本安装包_兄弟连安装gcc-程序员宅基地

文章浏览阅读4k次。声明:本系列文章是博主根据 “兄弟连新版Linux视频教程”做的笔记和视频截图,只为学习和教学使用,不适用任何商业用途。PS:文章基于Linux版本CentOS6.9,如果对Linux感兴趣,建议去看《细说Linux》,沈超老师和李明老师的教学风格我很喜欢:) 6.3 软件包管理-rpm包管理- yum在线管理视频6.3.1 软件包管理-rpm包管理-yum在线管理-IP地址配置和..._兄弟连安装gcc

HTML:本地存储的方法详解:_html本地存储-程序员宅基地

文章浏览阅读2.6k次。HTML:本地存储有四种方式。分别为:cookies、Storage 、Web SQL、IndexedDB。其中前端开发最常用的是Storage。下面来讲解一下他们的具体内容和区别;Cookie:构成: 名称 一个唯一确定cookie的名称 值 储存在cookie中的字符串值 域 cookie对于那个域是有效的 路径 指定域中的指定路径 失效时间 cookie何时应该被删除的时间戳 安全标志 指定后,cookie_html本地存储

CSDN日报19228——这4点微不足道的改变,正在带我起飞_csdn博客-程序员宅基地

文章浏览阅读2.8k次。程序人生 | 这4点微不足道的改变,正在带我起飞作者:沉默王二3个月前,我完全不懂什么叫个人品牌。我在CSDN上纯粹是为了写而写,完全不知道文章的作者——“沉默王二”就是我的个人品牌,就是我以后可以靠它生存的金字招牌。我在2015年就成为CSDN的博客专家了,排名达到1107,但竟然籍籍无名,除了七八个出版社的编辑找我写书外,再没有别的资源链接到我——“变现”和我之间隔着一条难以逾越的“..._csdn博客

白色简洁的瑞班克个人博客网站-程序员宅基地

文章浏览阅读101次。链接:http://pan.baidu.com/s/1eSqSY8E密码:yqaf转载于:https://www.cnblogs.com/wordblog/p/6804750.html_白色博客网站

java-poi实现:合并汇总不同ecxel的同名sheet页数据_java 对excel 数据汇总-程序员宅基地

文章浏览阅读705次。java-poi、excel操作_java 对excel 数据汇总

随便推点

Android WebView 网页使用本地字体_android 字体包给webview使用-程序员宅基地

文章浏览阅读6.5k次,点赞4次,收藏5次。要求在网页里面调用android app中assets目录下的某个字体文件。网页加载通常有两种方式:1、loadDataWithBaseURL2、loadUrl一、loadDataWithBaseURL网页中直接使用file://指定assets文件路径即可示例:font-family: url('file:///android_asset/xxx.TTF')二、loadUr..._android 字体包给webview使用

计算机网络课后作业(3)——数据链路层_6、若数据链路层的发送窗口尺寸wt=4,则在 发送3号帧,并接到2号帧的确认帧后,-程序员宅基地

文章浏览阅读6.1k次,点赞9次,收藏41次。一.单选题(共15题,100.0分)1、若数据链路层的发送窗口尺寸W=4,在发送3号帧、并收到2号帧的确认帧后,发送方还可以连续发送多少个帧?(采用累计确认)A、4B、2C、3D、1答案解析:由于是累计确认,收到2号帧的确认帧,说明2号帧以及之前的帧都被成功接收。可以从第三号帧开始再发4个帧。既然已经发出了一个3号帧并且没收到其确认帧,那就还可以连续发送4-1=3个帧。2、下列关于停-等ARQ协议,正确的描述是?A、仅当当前帧的 ACK 落入 *sent *(发送窗口),发送方发送下一帧B_6、若数据链路层的发送窗口尺寸wt=4,则在 发送3号帧,并接到2号帧的确认帧后,

PHP Laravel基础讲解_php controller 与 blade.php-程序员宅基地

文章浏览阅读786次。laravel目录结构app:laravel项目的核心代码app\Http\Controller.php: 定义控制器bootstrap:app.php:用于框架的启动和自动载入配置cache: 处理缓存config:配置文件database: 数据库public: 定义了项目的入口文件:index.php,localhost:8000,就会访问入口文件,前端静态资源resources: 本地化语言文件routes:路由storage: 要与app文件夹产生联系_php controller 与 blade.php

Java 中的常见错误和可能的错误(转)_exception in thread "thread-3" java.lang.runtimeex-程序员宅基地

文章浏览阅读1.9k次。 0、 需要标识符 a) 不在函数内 1、 非法表达式开始 b) 可能:丢失括号 . 2. no data found a) 可能:setInt(1,100)中,没有100这个值 3. 找不到符号 a) 可能:没导入包 4. 指定了无效URL a) 可能:数据库名或IP错误,即连接出错 5. 类路径没有找到 a) 可能: ClassNotFoundException: oracle.jdbc.dr_exception in thread "thread-3" java.lang.runtimeexception: java.lang.nullpoi

Mysql基础部分(12)---数据的增删改-程序员宅基地

文章浏览阅读198次。以往内容:Mysql基础部分(1)—基础操作指令与语法规范Mysql基础部分(2)—基础查询Mysql基础部分(3)—条件查询Mysql基础部分(4)—排序查询Mysql基础部分(5)—常见函数Mysql基础部分(6)—分组函数Mysql基础部分(7)—分组查询Mysql基础部分(8)—sql99语法Mysql基础部分(9)—子查询Mysql基础部分(10)—分页查询Mysq...

使用matlab绘制世界地图并根据经纬度绘制点位(附m_map的下载与安装说明)_matlab根据经纬度画地图-程序员宅基地

文章浏览阅读6.8w次,点赞74次,收藏410次。使用matlab绘制世界地图有两种方法(自己使用过的,可能有别的我不了解的方法):第一种是worldmap和geoshow;第二种是利用m_map工具箱;下面分别介绍这两种方法。1.worldmap & geoshowworldmap和geoshow是matlab中绘图工具箱的两个绘图函数,直接调用即可。worldmap的语法:worldmap region %r..._matlab根据经纬度画地图