本文整理汇总了PHP中SoapServer::AddFunction方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapServer::AddFunction方法的具体用法?PHP SoapServer::AddFunction怎么用?PHP SoapServer::AddFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapServer
的用法示例。
在下文中一共展示了SoapServer::AddFunction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gjAreLocal
* Provides a simple SOAP server for demo purposes
*
*/
require_once '../includes/gj_utility.inc.php';
require_once '../includes/gj_soap.inc.php';
require 'service_functions.php';
global $gjDebug;
global $gjXDebug;
global $gjLocal;
$gjLocal = gjAreLocal();
$gjDebug = true;
//for both set, do not comment out
$gjXDebug = false;
$server = new SoapServer("simpleO.wsdl");
$server->setClass('MyAPI', 'arg1 maybe a cert');
$server->AddFunction("getHello");
$server->AddFunction("getGoodbye");
$server->handle();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$server->handle();
} else {
echo "This SOAP server can handle following functions:<br>";
$functions = $server->getFunctions();
foreach ($functions as $func) {
echo $func . "<br>";
}
}
?>
示例2: doHello
<?php
if (!extension_loaded("soap")) {
dl("php_soap.dll");
}
ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer("wsdl.php");
function doHello($yourName)
{
return "Hello, " . $yourName;
}
$server->AddFunction("doHello");
$server->handle();
示例3: RegistrarSuce
<?php
include_once 'conexion/DBManager.php';
include_once "clases/cFormato.php";
if (!extension_loaded("soap")) {
dl("php_soap.dll");
}
ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer("services/ServicioEntidad.wsdl");
function RegistrarSuce($params)
{
$db = new ConSQL();
$db->connect();
$objFormato = new cFormato();
$objFormato->llenar($params);
$db->beginTransacction();
$res = $objFormato->insertar($db);
if ($res != null) {
$db->commit();
$msj = array("codigo" => "OK", "texto" => "Exito");
} else {
error_log("Entidad.WebServices ServicioEntidad->RegistrarSuce failed");
$db->rollback();
$msj = array("codigo" => "ERROR", "texto" => "No se pudo insertar: ");
}
return $msj;
}
// mysqli_close($con);
$server->AddFunction("RegistrarSuce");
$server->handle();
$server->addFunction(SOAP_FUNCTIONS_ALL);