php webservice实战
来源:互联网 发布:淘宝联盟做推广多少钱 编辑:程序博客网 时间:2024/05/01 09:41
做这个测试之前,要确认你的php配置文件中已经将soap扩展打开,即extension=php_soap.dll;
//server端 serverSoap.php
<?php
define('WBIN', TRUE);$soap = new SoapServer(null,array('uri'=>"http://192.168.1.11/"));//This uri is your SERVER ip.
$soap->addFunction('addData_func'); //Register the function
$soap->addFunction(SOAP_FUNCTIONS_ALL);
$soap->handle();
function addData_func($data = array()){
return json_encode($data);
}
//client端 clientSoap.php
<?php
define('WBIN', TRUE);
include 'config.inc.php';
include 'DBmysql.class.php';
include 'common.func.php';
include 'Curl.class.php';
error_reporting(E_ALL);
header("Content-type:text/html;charset=utf-8");
function getLoanInfo()
{
$_db = new DBmysql();
$sql = "SELECT
cld.account_number,cld.accntnm,cld.amt,cld.loan_num,cld.loan_type,cld.loan_time,cld.remark,cld.card,
crd.repay_num,crd.first_repay,crd.repay_date
FROM
crm_loan_dk as cld,
crm_repay_dk as crd
where cld.account_number = crd.account_number
and cld.status = 2 ";
$rs = $_db->executeQuery($sql);
//echo json_encode($rs);
//webservice post array
try {
$client = new SoapClient(null,
array('location' =>"http://192.168.1.11/text/webs/serverSoap.php",'uri' => "http://192.168.1.11/")
);
echo $client->addData_func($rs);
} catch (SoapFault $fault){
echo "Error: ",$fault->faultcode,", string: ",$fault->faultstring;
}
}
$action = strtolower(getParam('a'));
switch ($action)
{
case 'loaninfo': //放款用户基本信息
getLoanInfo();
break;
}
客户端调用服务器端函数
- php webservice实战
- 实战WebService II: SOAP篇(基于php)
- 实战WebService II: SOAP篇(基于php)
- 实战WebService II: SOAP篇(基于php)
- WebService实战
- WebService实战
- 主题:实战WebService II: SOAP篇(基于php)
- 实战WebService I: XML-PRC篇(基于php)
- PHP webservice
- webservice php
- PHP webservice
- php webservice
- [原创]JBuilder+WebService实战
- 实战Webservice (axis)
- webservice脚本开发实战
- AXIS2部署WebService实战
- Cxf WebService实战
- cxf+spring webservice实战
- cmdilistener1.3
- 数列特征
- IE11免费面向广大开发者
- 学习C++的专家推荐路线
- Java语言实现支持视频点播的WEB服务器
- php webservice实战
- IE11中打开同步选项卡
- 常用的<注册表>运行命令
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- linux--查看系统版本
- sprintf用法——把结果打印到打印字符串而不是终端
- iOS内购实现及测试排查错误列表
- poj1797 Heavy Transportation
- 点击按钮,表格自动增加一行的html代码