PHPERPHP技术交流 网络应用开发首页博客留言个人中心登录注册关于
PHP的SOAP工具包--nusoap
管理员2011-04-28 16:037460
0条评论收藏什么是SOAP
SOAP:简单对象访问协议,简单对象访问协议(SOAP)是一种轻量的、简单的、基于 XML 的协议,它被设计成在 WEB 上交换结构化的和固化的信息。
NuSOAP 是一组功能强大的PHP类,使得使用和创建SOAP消息变得相当简单。NuSOAP由Dirtrich Ayala编写,可以无缝地与很多最流行的SOAP服务实现交互,它遵循LGPL发布。NuSOAP提供了很多令人印象深刻的特性,包括:
●简单 :NuSOAP的面向对象方法隐藏了SOAP消息组装、解析、提交和接收的有关细节,使用户集中于应用程序本身。
●WSDL生成和导入 :NuSOAP可以生成一个对应于所发布Web服务的WSDL文档,并且能导入一个WSDL引用在NuSOAP客户端使用。
●代理类 :NuSOAP可以生成的一个代理类,允许调用远程方法,如同调用本地方法一样。
●HTTP代理 :出于多种原因(安全性和审计是其中两个原因),有些客户端被强制将请求委托给HTTP代理,由代理代表客户端执行请求。也就是说,需要所有SOAP请求都传递给此代理,而不是直接查询服务器。NuSOAP为指定代理服务器提供了基本支持。
●SSL :如果可以通过PHP使用CURL扩展,NuSOAP还支持通过SSL的安全通信。SOAP对PHP的版本要求
soap要求PHP5.0以上版本,且php默认是不加载soap模块的。解决方法是在php.ini中的Dynamic Extensions里添加:extension=php_soap.dll,如果原来有这一条,只是被注释掉了,那么只要把前边的分号去掉就可以了。
注:nusoap可以兼容PHP4和PHP5。SOAP相关基础知识
1.wsdl(web服务标记语言)
WSDL(网络服务描述语言,Web Services Description Language)是一门基于 XML 的语言,用于描述 Web Services 以及如何对它们进行访问。
具体参考请访问下面网址 http://www.w3school.com.cn/wsdl/index.asp
2.soap
SOAP 是一种简单的基于 XML 的协议,它使应用程序通过 HTTP 来交换信息。
具体参考请访问下面网址 http://www.w3school.com.cn/soap/index.asp
3.php扩展
具体参考请访问下面网址 http://php.net/manual/en/book.soap.phpNuSOAP的应用举例
天气预报接口调用:$client = new nusoap_client('http://www.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl', 'wsdl');
$client->soap_defencoding = 'utf-8';
$client->decode_utf8 = false;
$client->xml_encoding = 'utf-8';
$param = array('theUserID'=>'', 'theCityCode'=>$city);
$result = $client->call('getWeather', $param);
if(!$client->fault AND !$client->getError())
{
print_r($result);
}常用WEB SERVICE
天气预报Web Service ,数据来源于中国气象局
Endpoint : http://www.webxml.com.cn/WebServices/WeatherWebService.asmx
Disco : http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl
IP地址来源搜索Web Service (是目前最完整的IP地址数据)
Endpoint : http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx
Disco : http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl
随机英文、数字和中文简体字Web Service
Endpoint : http://www.webxml.com.cn/WebServices/RandomFontsWebService.asmx
Disco : http://www.webxml.com.cn/WebServices/RandomFontsWebService.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/RandomFontsWebService.asmx?wsdl
中国邮政编码
验证码图片Web Service 支持中文、字母、数字 图像和多媒体
Endpoint : http://www.webxml.com.cn/WebServices/ValidateCodeWebService.asmx
Disco : http://www.webxml.com.cn/WebServices/ValidateCodeWebService.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/ValidateCodeWebService.asmx?wsdl
Email 电子邮件地址验证Web Service
Endpoint : http://www.webxml.com.cn/WebServices/ValidateEmailWebService.asmx
Disco : http://www.webxml.com.cn/WebServices/ValidateEmailWebService.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/ValidateEmailWebService.asmx?wsdl
中文简体字
中文
火车时刻表Web Service (第六次提速最新列车时刻表)
Endpoint : http://www.webxml.com.cn/WebServices/TrainTimeWebService.asmx
Disco : http://www.webxml.com.cn/WebServices/TrainTimeWebService.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/TrainTimeWebService.asmx?wsdl
中国股票行情数据Web Service (支持深圳和上海股市的基金、债券和股票)
Endpoint : http://www.webxml.com.cn/WebServices/ChinaStockWebService.asmx
Disco : http://www.webxml.com.cn/WebServices/ChinaStockWebService.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/ChinaStockWebService.asmx?wsdl
即时外汇汇率数据Web Service
Endpoint : http://www.webxml.com.cn/WebServices/ExchangeRateWebService.asmx
Disco : http://www.webxml.com.cn/WebServices/ExchangeRateWebService.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/ExchangeRateWebService.asmx?wsdl
腾讯QQ在线状态Web Service
Endpoint : http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx
Disco : http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?disco
WSDL : http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl
中国电视节目预告 (电视节目表)Web Service
Endpoint : http://www.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx
Disco : http://www.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx?disco
WSDL : http://www.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx?wsdl
外汇-人民币即时报价Web Service
Endpoint : http://www.webxml.com.cn/WebServices/ForexRmbRateWebService.asmx
Disco : http://www.webxml.com.cn/WebServices/ForexRmbRateWebService.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/ForexRmbRateWebService.asmx?wsdl
中国股票行情分时走势预览缩略图Web Service
Endpoint : http://www.webxml.com.cn/webservices/ChinaStockSmallImageWS.asmx
Disco : http://www.webxml.com.cn/webservices/ChinaStockSmallImageWS.asmx?disco
WSDL : http://www.webxml.com.cn/webservices/ChinaStockSmallImageWS.asmx?wsdl
国内飞机航班时刻表 Web Service
Endpoint : http://www.webxml.com.cn/webservices/DomesticAirline.asmx
Disco : http://www.webxml.com.cn/webservices/DomesticAirline.asmx?disco
WSDL : http://www.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl
中国开放式基金数据Web Service
Endpoint : http://www.webxml.com.cn/WebServices/ChinaOpenFundWS.asmx
Disco : http://www.webxml.com.cn/WebServices/ChinaOpenFundWS.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/ChinaOpenFundWS.asmx?wsdl
股票行情数据 Web Service (支持香港、深圳、上海基金、债券和股票;支持多股票同时查询)
Endpoint : http://www.webxml.com.cn/WebServices/StockInfoWS.asmx
Disco : http://www.webxml.com.cn/WebServices/StockInfoWS.asmx?disco
WSDL : http://www.webxml.com.cn/WebServices/StockInfoWS.asmx?wsdl附件下载
nusoap-0.9.5.zip (177.77 KB)
共0条评论 发表评论发表评论 查看评论存档
2014年01月 (2)2013年11月 (1)2013年08月 (1)2013年07月 (1)2013年05月 (1)2013年02月 (5)2012年10月 (1)2012年08月 (1)2012年07月 (2)2012年06月 (1)2012年05月 (1)2012年03月 (1)2012年02月 (1)2011年11月 (1)2011年09月 (1)2011年07月 (1)2011年06月 (3)2011年05月 (1)2011年04月 (2)2011年03月 (3)2010年12月 (6)2010年11月 (9)2010年10月 (10)2010年09月 (24)2010年08月 (24)2010年07月 (25)2008年12月 (1)
分类
PHP基础编程技术数据库CSS/JS服务器
推荐阅读
PHP数据过滤JS获取下一节点的函数PHP+MYSQL实现全文检索JS身份证号码有效性验证PHP分页显示类JS函数的参数(arguments)的使用PHP接收邮件类(receivemail.class.php)下载PHP中文分词的实现
www.phper.org.cn ©2014 赣ICP备09008620号声明留言关于