第一步,首先下载 nusoap.php
下载地址 http://sourceforge.net/projects/nusoap/files/nusoap/
server.php 文件
<?php
include_once "lib/nusoap.php"; //导入nusoap.php,本站放在lib目录下?>
以上是生成wsdl的文件的方式,还有一种方法是说利用zend studio 7生成
第二步就是写php的服务端的接口
wsdl.php
<?php
class Wsdl extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('tganalysis/register_analysis_model');
}
function register($username, $gameid, $fromurl, $advertiser, $adfrom, $pagetype, $pagename, $tgid, $ip, $registertime) {
//保存注册信息
$this->register_analysis_model->tg_account = strtoupper($username);
$this->register_analysis_model->tg_gameID = $gameid;
$this->register_analysis_model->tg_fromurl = urldecode($fromurl);
$this->register_analysis_model->tg_advertiser = $advertiser; //广告商投放id
$this->register_analysis_model->tg_adFrom = $adfrom;
$this->register_analysis_model->tg_pagetype = $pagetype;
$this->register_analysis_model->tg_pagename = $pagename;
$this->register_analysis_model->tg_tgid = $tgid;
$this->register_analysis_model->tg_ip = $ip;
$this->register_analysis_model->tg_registerTime = date('Y-m-d H:i:s', $registertime);
try {
$this->register_analysis_model->save_tg_register();
} catch (SoapFault $e) {
return $e->getMessage();
}
return 0;
}
function index() {
ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer(APPPATH . 'libraries/data/tgRegister.wsdl', array('uri' => "http://gwact.woniu.com/jwl/wsdl?wsdl", 'encoding' => 'utf-8'));
$server->setClass("wsdl");
$server->addFunction(array('register'));
$server->addFunction(SOAP_FUNCTIONS_ALL);
$server->handle();
}
}
?>
最后说明以上经过实践证明可以使用,具体的根据自己的情况修改