//serverSoap_class.php
2016-04-15 08:54
661 查看
<?php
//serverSoap_class.php
$classExample = array();
$soap = new SoapServer(null,array('uri'=>"http://127.0.0.1/",'classExample'=>$classExample));
$soap->setClass('chesterClass');
$soap->handle();
class chesterClass {
public $name = 'Chester';
function getName() {
return $this->name;
}
}
<?php
//client端 clientSoap_class.php
try {
$client = new SoapClient(null,
array('location' =>"http://127.0.0.1/myphp/serverSoap_class.php",'uri' => "http://127.0.0.1/")
);
echo $client->getName();
} catch (SoapFault $fault){
echo "Error: ",$fault->faultcode,", string: ",$fault->faultstring;
}
//serverSoap_class.php
$classExample = array();
$soap = new SoapServer(null,array('uri'=>"http://127.0.0.1/",'classExample'=>$classExample));
$soap->setClass('chesterClass');
$soap->handle();
class chesterClass {
public $name = 'Chester';
function getName() {
return $this->name;
}
}
<?php
//client端 clientSoap_class.php
try {
$client = new SoapClient(null,
array('location' =>"http://127.0.0.1/myphp/serverSoap_class.php",'uri' => "http://127.0.0.1/")
);
echo $client->getName();
} catch (SoapFault $fault){
echo "Error: ",$fault->faultcode,", string: ",$fault->faultstring;
}
相关文章推荐
- OutputStream窥探
- callServer.php //serverSoap.php
- php实现webservice实例
- msmtp发送邮件的配置
- php生成图片验证码的方法
- PHP使用pear实现mail发送功能 windows环境下配置pear
- php使用pear_smtp发送邮件
- PHP6连接SQLServer2005的三部曲
- PHP 关于strtotime("- x month") bug的解决
- php与mysql中文乱码解决办法
- 利用php的构造函数与析构函数编写Mysql数据库查询类
- FTP主动模式与被动模式
- Thinkphp:引入第三方库的方法
- 创建Laravel项目的几种方法
- Laravel Spark的安装
- PHP页面纯静态化与伪静态化
- PHP:6种GET和POST请求发送方法
- PHP填坑记之FastCGI与mod_php详解
- 10个典型实用的PHP代码片段
- PHP大量数据循环时内存耗尽问题的解决方案