21,886
社区成员
发帖
与我相关
我的任务
分享
header("Content-Type:text/html;charset=utf-8");
define('S_ROOT', dirname(__FILE__).DIRECTORY_SEPARATOR);
@include_once (S_ROOT.'./source/nusoap.php');//插入文件
$server = new soap_server();
$server->soap_defencoding = 'UTF-8';
$server->configureWSDL('hellowsdl', 'urn:hellowsdl');
$server->wsdl->schemaTargetNamespace = 'urn:hellowsdl';
$server->register('hello', // method name
array('tablename'=>'xsd:string','msg'=>'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'urn:hellowsdl', // namespace
'urn:hellowsdl#hello', // soapaction
'rpc', // style
'encoded', // use
'Says hello to the caller' // documentation
);
function hello($tablename,$msg) {
$staut = '';
$uid = insert_msg($tablename,$msg);
if (!empty($uid)) {
$staut = 'ok';
}else
{
$staut = 'error';
}
return $staut;
}
function insert_msg($tablename,$msg)
{
$conn = mysql_pconnect("服务器地址","用户名","密码");
$title = '优惠信息';
mysql_select_db($tablename, $conn);
mysql_query("INSERT INTO zwmobi_channel_content(cid,title,content,time)VALUES('18','$title','$msg',now())");
return mysql_insert_id();
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
mysql_query("INSERT INTO zwmobi_channel_content(cid,title,content,time)VALUES('18','123','45689999',now())");
define('S_ROOT', dirname(__FILE__).DIRECTORY_SEPARATOR);
@include_once (S_ROOT.'./source/nusoap.php');//插入文件
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$client = new nusoap_client('webservice地址','wsdl',$proxyhost, $proxyport, $proxyusername, $proxypassword);
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
$err = $client->getError();
if ($err) {
echo '接口错误';
}
$tablename = 'tbt';
$msg = '这里是内容';
$RanStr=$client->call('hello',$tablename,$msg);
echo $RanStr;