建立自己的Web service(SOAP篇)
1、简介
这篇文章主要介绍采用SOAP来建立以及访问Web service接口。
Web service是一个平台独立的,低耦合的,自包含的、基于可编程的web的应用程序,可使用开放的XML(标准通用标记语言下的一个子集)标准来描述、发布、发现、协调和配置这些应用程序,用于开发分布式的互操作的应用程序。
Web Service技术, 能使得运行在不同机器上的不同应用无须借助附加的、专门的第三方软件或硬件, 就可相互交换数据或集成。依据Web Service规范实施的应用之间, 无论它们所使用的语言、 平台或内部协议是什么, 都可以相互交换数据。Web Service是自描述、 自包含的可用网络模块, 可以执行具体的业务功能。Web Service也很容易部署, 因为它们基于一些常规的产业标准以及已有的一些技术,诸如标准通用标记语言下的子集XML、HTTP。Web Service减少了应用接口的花费。Web Service为整个企业甚至多个组织之间的业务流程的集成提供了一个通用机制。
简而言之,当访问Web service,我们只需给定相应的数据条件就能够得到相应的信息。它的精华所在就是能够跨平台跨语言,即PHP构建的客户端能够访问java构建的Web service、.NET构建的客户端能够访问PHP构建的Web service、A服务器能够访问使用B服务器中的函数等等!
2、相关知识
Web Service也叫XML Web Service WebService是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求,轻量级的独立的通讯技术。是:通过SOAP在Web上提供的软件(服务),使用WSDL文件进行(说明),并通过(UDDI)进行注册。
XML:(Extensible Markup Language)扩展型可标记语言。面向短期的临时数据处理、面向万维网络,是Soap的基础。
Soap:(Simple Object Access Protocol)简单对象存取协议。是XML Web Service 的通信协议。当用户通过UDDI找到你的WSDL描述文档后,他通过可以SOAP调用你建立的Web服务中的一个或多个操作。SOAP是XML文档形式的调用方法的规范,它可以支持不同的底层接口,像HTTP(S)或者SMTP。
WSDL:(Web Services Description Language) WSDL 文件是一个 XML 文档,用于说明一组 SOAP 消息以及如何交换这些消息。大多数情况下由软件自动生成和使用。
WSDL(Web Service Description Language)Web服务器描述语言是用XML文档来描述Web服务的标准,是Web服务的接口定义语言,由Ariba、Intel、IBM、MS等共同提出,通过WSDL,可描述Web服务的三个基本属性:
- 服务做些什么——服务所提供的操作(方法)
- 如何访问服务——和服务交互的数据格式以及必要协议
- 服务位于何处——协议相关的地址,如URL
WSDL文档以端口集合的形式来描述Web服务,WSDL 服务描述包含对一组操作和消息的一个抽象定义,绑定到这些操作和消息的一个具体协议,和这个绑定的一个网络端点规范。WSDL 文档被分为两种类型:服务接口(service interface )和 服务实现(service implementations)。
服务接口文档中的主要元素为types、message、operation、portType、binding、port和service,他们的作用分别为:
types:定义了Web服务使用的所有数据类型集合,可被元素的各消息部件所引用。它使用某种类型系统(一般地使用XML Schema中的类型系统)。
message:通信消息数据结构的抽象类型化定义。使用Types所定义的类型来定义整个消息的数据结构。
operation:对服务中所支持操作的抽象描述。一般单个operation描述了一个访问入口的请求/响应消息对。
portType:对于某个访问入口点类型所支持操作的抽象集合。这些操作可以由一个或多个服务访问点来支持。
binding:包含了如何将抽象接口的元素(portType)转变为具体表示的细节,具体表示也就是指特定的数据格式和协议的结合;特定端口类型的具体协议和数据格式规范的绑定。
port:定义为协议/数据格式绑定与具体Web访问地址组合的单个服务访问点。
service:这是一个粗糙命名的元素,代表端口的集合;相关服务访问点的集合。
总结来看,portType(与message和type元素的细节相结合)描述了Web服务是什么,binding元素描述了如何使用Web服务,port及service元素描述了Web服务的位置。
3、访问大概流程
1、客户根据WSDL描述文档,会生成一个SOAP请求消息。(客户生成的SOAP请求会被嵌入在一个HTTP POST请求中,发送到Web服务器中。)
2、Web服务器再把这些请求转发给Web service请求处理器。(请求处理器的作用在于,解析收到的SOAP请求,调用Webservice,然后再生成相应的SOAP应答)
3、Web服务器得到SOAP应答后,会再通过HTTP应答的方式把它送回到客户端。
忽略其中的细节,简而言之就是浏览器访问Web服务器A中的相应程序(即服务器A定义调用服务器B Web service的应用程序,此程序是客户端);Web服务器B响应该请求,并调用执行相应的程序,最终以http响应将数据发给Web服务器A;Web服务器A在返回给浏览器。
SOAP使用HTTP传送XML,尽管HTTP不是有效率的通讯协议,而且XML还需要额外的文件解析(parse),两者使得交易的速度大大低于其它方案。
但是XML是一个开放、健全、有语义的讯息机制,而HTTP是一个广泛又能避免许多关于防火墙的问题,从而使SOAP得到了广泛的应用。
但是如果效率对自己来说很重要,那么应该多考虑其它的方式,而不要用SOAP。
可以参考下面的简图(具体细节忽略):

4、小试牛刀(访问国内飞机航班时刻表 WEB 服务)
接下来我们将来访问国内飞机航班时刻表 WEB 服务,先了解一些基本服务的情况。
该网站提供一些Web服务: http://www.webxml.com.cn/zh_cn/web_services.aspx
我们将选取国内飞机航班时刻表 WEB 服务来进行访问!

从上图中我们可以看到一个Web服务含有三个链接,分别代表三种途径Endpoint、Disco、WSDL。
那它们有什么不同呢?
Endpoint:web服务的URI地址,你访问之后,就会出现web服务的相关类描述、方法列表以及方法描述。
Disco:通过这个可以找到该web服务。即利用了web服务发现机制中的一种发现机制disco。
WSDL: 该web服务的描述性语言。即Web Services Description Language。用来描述你的web服务定义的方法和属性、binding协议部分、port端口以及服务URI。
我们当然是使用WSDL啦!
参考上面WSDL的介绍我们很容易就能看明白这个文件。
在PHP中存在一个扩展SOAP,使用它是很方便处理相应的SOAP类Web service!
步骤:
1、首先我们点击进入该WSDL文件,查看这个Web service提供什么功能、有什么方法、以及使用方法的参数、返回的结果类型等等。
我们将使用getDomesticAirlinesTime()进行测试

该方法需要填入相应的参数,包括出发城市、抵达城市、出发日期、(商业用户ID)
2、接下来使用PHP中的SOAP扩展中的SoapClient类进行访问该Web service
该文件我命名为test99.php
<?php
header("Content-type:text/html;charset=utf-8;");
$client = new SoapClient("http://ws.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl");
echo "<pre>";
print_r($client->__getFunctions()); #查看该WSDL所有方法
echo "</pre>";
$arr=array('startCity'=>'北京', 'lastCity'=>'广州', 'theDate'=>'2017-05-22'); #参数信息、数组形势
$a=$client->getDomesticAirlinesTime($arr);
echo "<pre>";
print_r($a);
echo "</pre>";
$c= $client->__soapCall('getDomesticAirlinesTime', array('getDomesticAirlinesTime'=>$arr));
echo "<pre>";
print_r($c);
echo "</pre>";die;
?>
浏览器访问test99.php,结果如下

5、用牛刀宰牛啦(使用SOAP构建Web service)
PHP中的SOAP可分为WSDL类型SOAP与非WSDL类型SOAP,现如今大多数使用的SOAP是含有WSDL的。个人对与这两种的理解是:含WSDL是标准类型的,因为WSDL使用了XML标准语法对你提供的方法类进行了描述(描述服务)。接下来我们将构建WSDL类型的SOAP Web service接口。
步骤:
目录构造如下:

1、先构造好我们需要提供服务的功能方法
Webserciec.class.php(这个类很简单,只是做个测试;当然这里可以写我们想要提供的任何功能,各种逻辑,以及数据服务等等。)
<?php
Class WebService
{
public function getTest($a)
{
return "The msg from WebService".$a;
}
public function test($b,$c)
{
return $b+$c;
}
}
?>
2、构建WSDL文件(即使用WSDL对Webservice.class.php类文件进行相应的服务描述)
由于PHP中没有将该类生成WSDL文件的功能函数,因此我们需要借助别的工具将WSDL文件构造出来!
下面是一个SoapDiscovery.class.php类文件,可以生成相应的WSDL文件
<?php /**
* Copyright (c) 2005, Braulio Jos?Solano Rojas
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the Solsoft de Costa Rica S.A. nor the names of its contributors may
* be used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* @version $Id: SoapDiscovery.class.php 66 2013-04-10 07:12:21Z ideaa $
* @copyright 2005
*/ /**
* SoapDiscovery Class that provides Web Service Definition Language (WSDL).
*
* @package SoapDiscovery
* @author Braulio Jos?Solano Rojas
* @copyright Copyright (c) 2005 Braulio Jos?Solano Rojas
* @version $Id: SoapDiscovery.class.php 66 2013-04-10 07:12:21Z ideaa $
* @access public
* */
class SoapDiscovery { private $class_name = '';
private $service_name = '';
private $address = ''; /**
* SoapDiscovery::__construct() SoapDiscovery class Constructor.
*
* @param string $class_name
* @param string $service_name
* */
public function __construct($class_name = '', $service_name = '', $address = '') {
$this->class_name = $class_name;
$this->service_name = $service_name;
$this -> address = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF'];
if(!empty($address))
$this -> address = $address;
} /**
* SoapDiscovery::getWSDL() Returns the WSDL of a class if the class is instantiable.
*
* @return string
* */
public function getWSDL() {
if (empty($this->service_name)) {
throw new Exception('No service name.');
}
$headerWSDL = "<?xml version=\"1.0\" ?>\n";
$headerWSDL.= "<definitions name=\"$this->service_name\" targetNamespace=\"urn:$this->service_name\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:tns=\"urn:$this->service_name\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns=\"http://schemas.xmlsoap.org/wsdl/\">\n";
$headerWSDL.= "<types xmlns=\"http://schemas.xmlsoap.org/wsdl/\" />\n"; if (empty($this->class_name)) {
throw new Exception('No class name.');
} $class = new ReflectionClass($this->class_name); if (!$class->isInstantiable()) {
throw new Exception('Class is not instantiable.');
} $methods = $class->getMethods(); $portTypeWSDL = '<portType name="' . $this->service_name . 'Port">';
$bindingWSDL = '<binding name="' . $this->service_name . 'Binding" type="tns:' . $this->service_name . "Port\">\n<soap:binding style=\"rpc\" transport=\"http://schemas.xmlsoap.org/soap/http\" />\n";
$serviceWSDL = '<service name="' . $this->service_name . "\">\n<documentation />\n<port name=\"" . $this->service_name . 'Port" binding="tns:' . $this->service_name . "Binding\"><soap:address location=\"".$this ->address."\" />\n</port>\n</service>\n";
$messageWSDL = '';
foreach ($methods as $method) {
if ($method->isPublic() && !$method->isConstructor()) {
$portTypeWSDL.= '<operation name="' . $method->getName() . "\">\n" . '<input message="tns:' . $method->getName() . "Request\" />\n<output message=\"tns:" . $method->getName() . "Response\" />\n</operation>\n";
$bindingWSDL.= '<operation name="' . $method->getName() . "\">\n" . '<soap:operation soapAction="urn:' . $this->service_name . '#' . $this->class_name . '#' . $method->getName() . "\" />\n<input><soap:body use=\"encoded\" namespace=\"urn:$this->service_name\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" />\n</input>\n<output>\n<soap:body use=\"encoded\" namespace=\"urn:$this->service_name\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" />\n</output>\n</operation>\n";
$messageWSDL.= '<message name="' . $method->getName() . "Request\">\n";
$parameters = $method->getParameters();
foreach ($parameters as $parameter) {
$messageWSDL.= '<part name="' . $parameter->getName() . "\" type=\"xsd:string\" />\n";
}
$messageWSDL.= "</message>\n";
$messageWSDL.= '<message name="' . $method->getName() . "Response\">\n";
$messageWSDL.= '<part name="' . $method->getName() . "\" type=\"xsd:string\" />\n";
$messageWSDL.= "</message>\n";
}
}
$portTypeWSDL.= "</portType>\n";
$bindingWSDL.= "</binding>\n";
//return sprintf('%s%s%s%s%s%s', $headerWSDL, $portTypeWSDL, $bindingWSDL, $serviceWSDL, $messageWSDL, '</definitions>');
//生成wsdl文件,将上面的return注释
$fso = fopen($this->class_name . ".wsdl", "w");
fwrite($fso, sprintf('%s%s%s%s%s%s', $headerWSDL, $portTypeWSDL, $bindingWSDL, $serviceWSDL, $messageWSDL, '</definitions>'));
} /**
* SoapDiscovery::getDiscovery() Returns discovery of WSDL.
*
* @return string
* */
public function getDiscovery() {
return "<?xml version=\"1.0\" ?>\n<disco:discovery xmlns:disco=\"http://schemas.xmlsoap.org/disco/\" xmlns:scl=\"http://schemas.xmlsoap.org/disco/scl/\">\n<scl:contractRef ref=\"http://" . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['PHP_SELF'] . "?wsdl\" />\n</disco:discovery>";
} } ?>
getWSDL.php文件
<?php
include ('./WebService.class.php');
include ('./SoapDiscovery.class.php');
$wsdl =new SoapDiscovery('WebService','a','http://www.test99.com/ok/server.php'); #第一个是参数为类名、第二个参数为服务名(可以随便写)、第三个参数为提供服务的接口文件
$wsdl -> getWSDL();
?>
访问http://www.test99.com/ok/getWSDL.php,即可生成WebService.WSDL文件
<?xml version="1.0" ?>
<definitions name="a" targetNamespace="urn:a" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:a" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types xmlns="http://schemas.xmlsoap.org/wsdl/" />
<portType name="aPort"><operation name="getTest">
<input message="tns:getTestRequest" />
<output message="tns:getTestResponse" />
</operation>
<operation name="test">
<input message="tns:testRequest" />
<output message="tns:testResponse" />
</operation>
</portType>
<binding name="aBinding" type="tns:aPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="getTest">
<soap:operation soapAction="urn:a#WebService#getTest" />
<input><soap:body use="encoded" namespace="urn:a" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:a" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
<operation name="test">
<soap:operation soapAction="urn:a#WebService#test" />
<input><soap:body use="encoded" namespace="urn:a" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:a" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="a">
<documentation />
<port name="aPort" binding="tns:aBinding"><soap:address location="http://www.test99.com/ok/server.php" />
</port>
</service>
<message name="getTestRequest">
<part name="a" type="xsd:string" />
</message>
<message name="getTestResponse">
<part name="getTest" type="xsd:string" />
</message>
<message name="testRequest">
<part name="b" type="xsd:string" />
<part name="c" type="xsd:string" />
</message>
<message name="testResponse">
<part name="test" type="xsd:string" />
</message>
</definitions>
3、建立Server.php服务文件
<?php
include("WebService.class.php");
$server = new SoapServer("WebService.wsdl");
$server -> setClass("WebService");
$server -> handle();
?>
大功告成,给外部提供接口,http://www.test99.com/ok/Server.php?wsdl
4、开始访问,在www.test88.com主机中建立客户端程序
Client.php
header("Content-type:text/html;charset=utf-8;");
$client = new SoapClient("http://www.test99.com/ok/Server.php?wsdl");
echo "<pre>";
print_r($client->__getFunctions());
echo "</pre>";
echo $client->__soapCall('test',array('1','2'));
echo "<br/>";
try{
echo $result=$client -> test('2','2');
}catch(SoapFault $e){
echo $e->getMessage();
}
访问http://www.test88.com/Client.php,结果如下所示:

根据上图我们采用SOAP建立Web service成功!建立Web service就是这么简单
6、总结
当然我这里仅仅只是建立了一个对外开放的Web服务,但是这个服务如果不加以说明注释别人肯定不知道这个服务有什么作用呀、该怎么使用呀等等。这些东西在这篇文章中还没有提到,大家需切记哈!
(以上是自己的一些见解,若有不足或者错误的地方请各位指出)
作者:那一叶随风 http://www.cnblogs.com/phpstudy2015-6/
原文地址:http://www.cnblogs.com/phpstudy2015-6/p/6842463.html
声明:本博客文章为原创,只代表本人在工作学习中某一时间内总结的观点或结论。转载时请在文章页面明显位置给出原文链接
建立自己的Web service(SOAP篇)的更多相关文章
- 关于 php 调用 其他语言写的Web Service SOAP 接口的参数传递问题
关于 php 调用 其他语言写的Web Service SOAP 接口的参数传递问题,有需要的朋友可以参考下. php调用java写的soap接口经验: 场景一: java是以数组的形式接收参数的 ...
- web service,soap ,http,tcp,udp
webservice and soap HTTP只负责把数据传送过去,不会管这个数据是XML.HTML.图片.文本文件或者别的什么.而SOAP协议则定义了怎么把一个对象变成XML文本,在远程如何调用 ...
- [ Web Service ] [ SOAP ] [ JSON ] [ XML ] 格式轉換
JSON格式產生器_Demo JSON格式產生器_ObjGen - Live JSON Generator JSON格式整理_JSON Formatter & Validator Online ...
- Web Service学习笔记(webservice、soap、wsdl、jws详细分析)
Web Service概述 Web Service的定义 W3C组织对其的定义如下,它是一个软件系统,为了支持跨网络的机器间相互操作交互而设计.Web Service服务通常被定义为一组模块化的API ...
- Web Service学习笔记(webservice、soap、wsdl、jws详细分析) (转)
Web Service概述 Web Service的定义 W3C组织对其的定义如下,它是一个软件系统,为了支持跨网络的机器间相互操作交互而设计.Web Service服务通常被定义为一组模块化的API ...
- Web Service简要概念,学习记录!
Web Service平台需要一套协议来实现分布式应用程序的创建.任何平台都有它的数据表示方法和类型系统.要实现互操作性,Web Service平台必须提供一套标准的类型系统,用于沟通不同平台.编程语 ...
- Consuming a RESTful Web Service
本篇文章将介绍使用Spring来建立RESTful的Web Service. 我们通过一个例子来说明这篇文章:这个例子将会使用Spring的RestTemplate来从Facebook的提供的API中 ...
- 怎样创建.NET Web Service http://blog.csdn.net/xiaoxiaohai123/article/details/1546941
为什么需要Web Service 在通过internet网购买商品后,你可能对配送方式感到迷惑不解.经常的情况是因配送问题找配送公司而消耗你的大量时间,对于配送公司而言这也不是一项增值服务. 为了解决 ...
- [C#]動態叫用Web Service
http://www.dotblogs.com.tw/jimmyyu/archive/2009/04/22/8139.aspx 摘要 Web Service對大家來說想必都不陌生,也大都了解Web S ...
随机推荐
- IE6 margin 双倍边距解决方案
一.什么是双边距Bug? 先来看图: 我们要让绿色盒模型在蓝色盒模型之内向左浮动,并且距蓝色盒模型左侧100像素.这个例子很常见,比如在网页布局中,侧边栏靠左侧内容栏浮动,并且要留出内容栏的宽度.要实 ...
- Laravel查询构造器的使用方法整理
1.结果集 1.1从一张表获取所有行,get方法获取所有行 $users = DB::table('users')->get(); 获取列的值 foreach ($users as $user) ...
- 老李分享知识:性能测试之TPS和吞吐率
老李分享知识:性能测试之TPS和吞吐率 当增大系统的压力(或添加并发用户数)时,吞吐率和TPS的改变曲线呈大体一致,则系统基本稳定. 若压力增大时,吞吐率的曲线添加到一定程度后出现改变缓 ...
- 使用cocapods报错 [!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes
从github上下载的工程大部分都使用了cocapods,在install的时候可能会报错. 报错原因: 1.不要使用文本编辑去编辑Podfile文件,使用Xcode编辑,或者使用终端敲命令去编辑. ...
- JavaScript基础学习(五)—其他引用类型
JavaScript定义了两个内置对象: Global和Math. 一.Global对象 1.URI编码方法 Global对象的encodeURI()和encodeURICompo ...
- [认证授权] 3.基于OAuth2的认证(译)
OAuth 2.0 规范定义了一个授权(delegation)协议,对于使用Web的应用程序和API在网络上传递授权决策非常有用.OAuth被用在各钟各样的应用程序中,包括提供用户认证的机制.这导致许 ...
- Ant Design 的一个练习小Demo
Ant Design 由蚂蚁金服团队出品, 基于 React 的组件化开发模式,封装了一套丰富而实用的 UI 组件库. 在这个练习Demo 中,按照 Ant Design 官网的教程示例,尝试使用 A ...
- file_get_contents HTTP request failed! Internal Server Error
使用file_get_contents报错 Severity: WarningMessage: file_get_contents(http://geetest.com:8000/select?gid ...
- GitHub上最受欢迎的iOS开源项目TOP20
AFNetworking 在众多iOS开源项目中,AFNetworking可以称得上是最受开发者欢迎的库项目.AFNetworking是一个轻量级的iOS.Mac OS X网络通信类库,现在是GitH ...
- java映射(map用法)
主要分两个接口:collection和Map 主要分三类:集合(set).列表(List).映射(Map)1.集合:没有重复对象,没有特定排序方式2.列表:对象按索引位置排序,可以有重复对象3.映射: ...