示例#1
1
 public function soapAction()
 {
     $server = new soap_server();
     $server->configureWSDL('productservice', 'urn:ProductModel', URL . 'product/soap');
     $server->wsdl->schemaTargetNamespaces = 'urn:ProductModel';
     $server->wsdl->addComplexType('Producto', 'complexType', 'struct', 'all', '', array('idproducto' => array('name' => 'idproducto', 'type' => 'xsd:string'), 'titulo' => array('name' => 'titulo', 'type' => 'xsd:string'), 'descripcion' => array('name' => 'descripcion', 'type' => 'xsd:string'), 'precio' => array('name' => 'precio', 'type' => 'xsd:integer'), 'gatosdeenvio' => array('name' => 'gatosdeenvio', 'type' => 'xsd:integer'), 'marca' => array('name' => 'marca', 'type' => 'xsd:string'), 'createdAt' => array('name' => 'createdAt', 'type' => 'xsd:string'), 'iddescuento' => array('name' => 'iddescuento', 'type' => 'xsd:string'), 'idcolor' => array('name' => 'idcolor', 'type' => 'xsd:string'), 'idtalla' => array('name' => 'idtalla', 'type' => 'xsd:string'), 'stock' => array('name' => 'stock', 'type' => 'xsd:string'), 'idsubcategoria' => array('name' => 'idsubcategoria', 'type' => 'xsd:string'), 'idimagen' => array('name' => 'idimagen', 'type' => 'xsd:integer'), 'path' => array('name' => 'path', 'type' => 'xsd:string')));
     $server->wsdl->addComplexType('Productos', 'complexType', 'array', 'sequence', '', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:Producto[]')), 'tns:Producto');
     $server->register("ProductModel.selecWithCategorySubcatAndProduct", array("category" => "xsd:string", "subcategory" => "xsd:string", "group" => "xsd:string"), array("return" => "tns:Productos"), "urn:ProductModel", "urn:ProductModel#selecWithCategorySubcatAndProduct", "rpc", "encoded", "Get products by category or subcategory");
     $server->register("ProductModel.toArray", array("id" => "xsd:string"), array("return" => "xsd:Array"), "urn:ProductModel", "urn:ProductModel#toArray", "rpc", "encoded", "Get products id or all");
     $POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
     @$server->service($POST_DATA);
 }
示例#2
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library('nusoap');
     $servicio = new soap_server();
     $servicio->soap_defencoding = 'UTF-8';
     $servicio->decode_utf8 = false;
     $servicio->encode_utf8 = true;
     $ns = "urn:cero_code";
     $servicio->configureWSDL("cero_codeWS", $ns);
     $servicio->schemaTargetNamespace = $ns;
     $servicio->register("get_code", array('id_usuario' => 'xsd:string'), array('return' => 'xsd:string'), $ns, false, 'rpc', 'encoded', 'Cero Code');
     function get_code($id_usuario)
     {
         $CI =& get_instance();
         $CI->load->model('inventario/Inventario_model');
         $codigo = $CI->Inventario_model->get_code($id_usuario);
         return $codigo;
     }
     // 		$servicio->wsdl->addComplexType('Usuario','complexType','struct','all','',
     // array( 'id' => array('name' => 'id','type' => 'xsd:int'),
     // 'usuario' => array('name' => 'usuario','type' => 'xsd:string')));
     $servicio->register("get_usuarios", array(), array('return' => 'xsd:string'), $ns, false, 'rpc', 'encoded', 'Cero Code');
     function get_usuarios()
     {
         $CI =& get_instance();
         $CI->load->model('login/Login_model');
         //$usuarios = new stdClass();
         //$usuarios->lista = $CI->Login_model->get_usuarios();
         $usuarios = $CI->Login_model->get_usuarios();
         return json_encode($usuarios);
     }
     $servicio->service(file_get_contents("php://input"));
 }
示例#3
0
 public static function server()
 {
     $server = new \soap_server();
     //$namespace = "http://localhost:8000/ws";
     $server->configureWSDL('server.hello', 'urn:server.hello', Request::url());
     //$server->configureWSDL('OverService',$namespace);
     $server->wsdl->schemaTargetNamespace = 'urn:server.hello';
     //$server->decode_utf8 = true;
     //$server->soap_defencoding = "UTF-8";
     $server->register('hello', array('name' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:server.hello', 'urn:server.hello#hello', 'rpc', 'encoded', 'Retorna o nome');
     function hello($name)
     {
         return 'Hello ' . $name;
     }
     // respuesta para uso do serviço
     return Response::make($server->service(file_get_contents("php://input")), 200, array('Content-Type' => 'text/xml; charset=ISO-8859-1'));
 }
//Llamar a la librería que corresponde
require_once "lib/nusoap.php";
//Declaramos el NameSpace
$namespace = "urn:EjWS7_Server";
//Creamos el servidor con el que vamos a trabajar
$server = new soap_server();
//Configuramos el WSDL
$server->configureWSDL("EjWS7_Server");
//Asignamos nuestro NameSpace
$server->wsdl->schemaTargetNameSpace = $namespace;
//Registramos el método para que sea léido por el sistema
//El formato es register(nombreMetodo, parametrosEntrada, parametrosSalida, namespace, soapaction, style, uso, descripcion)
//nombreMetodo: Es el nombre el método.
//parametrosEntrada: Van dentro de un arreglo, así: array('param1'=>'xsd:string', 'param2'=>'xsd:int')
//parametrosSalida: Van igual que los parametros de Entrada. Por defecto: array('return'=>'xsd:string')
//namespace: Colocamos el namespace que obtuvimos anteriormente.
//soapaction: Ocupamos la por defecto: false
//style: Estilo, tenemos rpc o document.
//use: encoded o literal.
//description: Descripción del método.
$server->register('funcionEjWS7', array("nroTramite" => "xsd:int"), array("vigenciaTramite" => "xsd:boolean", "cuponPago" => "xsd:string", "valorTramite" => "xsd:string"), $namespace, false, 'rpc', 'encoded', 'Descripcion Ejemplo Tres');
//creamos el metodo, el nombre del método debe calzar con lo que colocamos anteriormente en register.
function funcionEjWS7($nroTramite)
{
    return array("vigenciaTramite" => true, "cuponPago" => "Uno", "valorTramite" => "dos");
}
// Se envía la data del servicio en caso de que este siendo consumido por un cliente.
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
// Enviamos la data a través de SOAP
$server->service($POST_DATA);
exit;
示例#5
0
 function soap_serve($wsdl, $functions)
 {
     global $HTTP_RAW_POST_DATA;
     $s = new soap_server($wsdl);
     $s->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
 }
示例#6
0
<?php 
	require_once("lib/nusoap.php"); 
	function concatenate($str1,$str2) {
		if (is_string($str1) && is_string($str2))
			return $str1 . $str2;
		else
			return new soap_fault(' 客户端 ','','concatenate 函数的参数应该是两个字符串 ');
	}
	$soap = new soap_server;
	$soap->register('concatenate');
	$soap->service($HTTP_RAW_POST_DATA);
?> 
示例#7
0
    $errors_returned = array(0 => 'success', 1 => 'file import does not exist', 2 => 'no users to import', 3 => 'wrong datas in file', 4 => 'security error');
    // Check whether this script is launch by server and security key is ok.
    if (empty($_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] || $security_key != $_configuration['security_key']) {
        return $errors_returned[4];
    }
    // Libraries
    require_once 'import.lib.php';
    // Check is users file exists.
    if (!is_file($filepath)) {
        return $errors_returned[1];
    }
    // Get list of users
    $users = parse_csv_data($filepath);
    if (count($users) == 0) {
        return $errors_returned[2];
    }
    // Check the datas for each user
    $errors = validate_data($users);
    if (count($errors) > 0) {
        return $errors_returned[3];
    }
    // Apply modifications in database
    save_data($users);
    return $errors_returned[0];
    // Import successfull
}
$server = new soap_server();
$server->register('import_users_from_file');
$http_request = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($http_request);
				//allow XSS by not encoding output
				$lTargetHostText = $pTargetHost;	    		
	    	}//end if
		    	
		}catch(Exception $e){
			echo $CustomErrorHandler->FormatError($e, "Error setting up configuration on page dns-lookup.php");
		}// end try	
		
	    try{
	    	$lResults = "";
	    	if ($lTargetHostValidated){
	    		$lResults .= '<results host="'.$lTargetHostText.'">';
    			$lResults .=  shell_exec("nslookup " . $pTargetHost);
    			$lResults .= '</results>';
				$LogHandler->writeToLog("Executed operating system command: nslookup " . $lTargetHostText);
	    	}else{
	    		$lResults .= "<message>Validation Error</message>";
	    	}// end if ($lTargetHostValidated){
			
	    	return $lResults;
	    	
    	}catch(Exception $e){
			echo $CustomErrorHandler->FormatError($e, "Input: " . $pTargetHost);
    	}// end try
		
	}//end function

	// Use the request to (try to) invoke the service
	$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
	$lSOAPWebService->service($HTTP_RAW_POST_DATA);
?>
示例#9
0
                    $anex_codigo = $radicado . "_" . substr("00000" . $anex_numero, -5);
                    $query = "SELECT ANEX_TIPO_CODI FROM ANEXOS_TIPO WHERE ANEX_TIPO_EXT='{$extension}'";
                    $tmp_anex_tipo = $conn->GetOne($query);
                    $anex_tipo = empty($tmp_anex_tipo) ? "0" : $tmp_anex_tipo;
                    $fechaAnexado = $conn->OffsetDate(0, $conn->sysTimeStamp);
                    $query = "INSERT INTO ANEXOS\n                                (ANEX_CODIGO, ANEX_RADI_NUME, ANEX_TIPO, ANEX_TAMANO, ANEX_SOLO_LECT,\n                                ANEX_CREADOR, ANEX_DESC, ANEX_NUMERO, ANEX_NOMB_ARCHIVO, ANEX_ESTADO,\n                                SGD_REM_DESTINO, ANEX_FECH_ANEX, ANEX_BORRADO)\n                            VALUES\n                                ('{$anex_codigo}', {$radicado}, {$anex_tipo}, " . round($anex_tamano / 1024, 2) . ", 'n',\n                                '{$usrRadicador}','{$descripcion}', {$anex_numero}, '{$anex_codigo}.{$extension}', 0,\n                                1, {$fechaAnexado}, 'N')";
                    $nuevoNombreArchivo = "{$anex_codigo}.{$extension}";
                }
            }
            if ($validaOk) {
                $rs = $conn->Execute($query);
                $ok_r = rename("{$ruta}{$nombreArchivo}", "{$ruta}{$nuevoNombreArchivo}");
                if ($rs === false || $ok_r === false) {
                    return new soap_fault('Server', '', "Error en la actualizacion en BD. <!-- {$ok_r} -->");
                }
                return $rs ? $validaOk : $rs;
            } else {
                return new soap_fault('Client', '', 'Los siguientes errores fueron hallados:<br>' . implode('<br>', $cadError));
            }
        } else {
            return new soap_fault('Client', '', 'Radicado debe ser numerico.');
        }
    }
}
if (isset($HTTP_RAW_POST_DATA)) {
    $input = $HTTP_RAW_POST_DATA;
} else {
    $input = implode("\r\n", file('php://input'));
}
$objServer->service($input);
exit;
示例#10
0
/*@@@@@@@@@@@@@@@@@@ SPORTS @@@@@@@@@@@@@@@@@@@*/
$server->wsdl->addComplexType('ArrayOfString', 'complexType', 'array', 'sequence', '', array('itemName' => array('name' => 'itemName', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => 'unbounded')));
/************************************************************************************/
/******************************** FUNCTIONS REGISTER ********************************/
/************************************************************************************/
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@@@@@@@@@@@@@@@@@@ TESTS @@@@@@@@@@@@@@@@@@*/
$server->register('sayHello', array('input' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#sayHello', 'rpc', 'encoded', 'Return the square of a number');
$server->register('Square', array('input' => 'xsd:int'), array('return' => 'xsd:int'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#Square', 'rpc', 'encoded', 'Return the square of a number');
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@@@@@@@@@@@@@@@@@@ EVENTS @@@@@@@@@@@@@@@@@@*/
$server->register('AddEvent', array('sport' => 'xsd:string', 'owner' => 'xsd:int', 'visibility' => 'xsd:string', 'date_time' => 'xsd:string', 'duration' => 'xsd:int', 'location' => 'xsd:string', 'longitude' => 'xsd:float', 'latitude' => 'xsd:float', 'description' => 'xsd:string'), array('return' => 'xsd:int'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#AddEvent', 'rpc', 'encoded', 'Add a new event in the data base');
$server->register('GetEventsId', array('visibility' => 'xsd:string', 'sports_string' => 'xsd:string', 'id_user' => 'xsd:int'), array('return' => 'tns:ArrayOfInt'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#GetEventsId', 'rpc', 'encoded', 'Returns a list of all the visible events\' id');
$server->register('GetEvent', array('id_event' => 'xsd:int'), array('return' => 'xsd:string'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#GetEvent', 'rpc', 'encoded', 'Returns a structure of an event');
$server->register('GetInvolvedIn', array('id_event' => 'xsd:int'), array('return' => 'xsd:string'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#GetInvolvedIn', 'rpc', 'encoded', 'Returns all the involved users of an event');
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@@@@@@@@@@@@@@@@@@ USERS @@@@@@@@@@@@@@@@@@*/
$server->register('AddUser', array('external_id' => 'xsd:string', 'log_manager' => 'xsd:string', 'full_name' => 'xsd:string', 'url_avatar' => 'xsd:string', 'gender' => 'xsd:string', 'date_of_birth' => 'xsd:string'), array('return' => 'xsd:int'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#AddUser', 'rpc', 'encoded', 'Try to add an external user to the data base.The internal id of the new user is returned. If the user was already registered, the function just return his internal id. In case of fail, returns -1;');
$server->register('IsUser', array('log_manager' => 'xsd:string', 'external_id' => 'xsd:string'), array('return' => 'xsd:int'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#IsUser', 'rpc', 'encoded', 'indicates whether the input external user is already member of RioSport');
$server->register('GetUser', array('id_user' => 'xsd:int'), array('return' => 'tns:friend'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#GetUser', 'rpc', 'encoded', 'Returns all the informations about an user. Returns null if this user does not exist');
$server->register('GetPracticedSports', array('id_user' => 'xsd:int'), array('return' => 'tns:ArrayOfString'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#GetPracticedSports', 'rpc', 'encoded', 'Returns a list of the practiced sports by the user. It is returned in an array of string. The 0 and paired indices are the sports and the impaired indices are the level of the previous sport.');
$server->register('GetInternalId', array('log_manager' => 'xsd:string', 'external_id' => 'xsd:string'), array('return' => 'xsd:int'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#GetInternalId', 'rpc', 'encoded', 'returns the internal id of an user. In case of fail, returns -1.');
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@@@@@@@@@@@@@@@@@@ FRIENDS @@@@@@@@@@@@@@@@@@*/
$server->register('GetFriendsOf', array('id_user' => 'xsd:int'), array('return' => 'tns:ArrayOfInt'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#GetFriendsOf', 'rpc', 'encoded', 'Return all the friends of the requested user');
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@@@@@@@@@@@@@@@@@@ SPORTS @@@@@@@@@@@@@@@@@@@*/
$server->register('GetSports', array(), array('return' => 'tns:ArrayOfString'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#GetSports', 'rpc', 'encoded', 'Returns the list of available sports');
$server->register('GetLevels', array(), array('return' => 'tns:ArrayOfString'), $NAMESPACE, 'https://www.etud.insa-toulouse.fr/~pamaury/webService#GetLevels', 'rpc', 'encoded', 'Returns the list of available sports');
$server->service(isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '');
示例#11
0
<?php

require_once '../lib/nusoap.php';
$targetNamespace = 'http://localhost/simplesoap/server/';
$serverAuth = new soap_server();
$serverAuth->configureWSDL('Validate', $targetNamespace);
$serverAuth->wsdl->schemaTargetNamespace = $targetNamespace;
$serverAuth->register('Validate', ['username' => 'xsd:string', 'password' => 'xsd:string'], ['return' => 'xsd:Array'], $targetNamespace);
function Validate($username, $password)
{
    $connection = mysqli_connect('localhost', 'root', 'marwek', 'trying');
    $query = "SELECT user_alias,user_name,user_level FROM users WHERE user_name = '{$username}'";
    $result = mysqli_query($connection, $query);
    $numsRow = mysqli_num_rows($result);
    if ($numsRow == 1) {
        $row = mysqli_fetch_assoc($result);
        return $row;
    } else {
        return 'Fails';
    }
}
$rawPostData = file_get_contents('php://input');
$serverAuth->service($rawPostData);
示例#12
0
文件: index.php 项目: ratno/ratno_ws
        $desc .= nbsp(4) . ")" . "<br />";
    } else {
        $desc .= "[data] => sekumpulan array data <br />";
        $desc .= nbsp(4) . "array (" . "<br />";
        $desc .= nbsp(8) . "[idx] => array (" . "<br />";
        $i = 0;
        foreach ($service['fields'] as $field) {
            $desc .= nbsp(12) . "[" . $i++ . "] => [data " . $field . "]<br />";
        }
        $desc .= nbsp(8) . ")" . "<br />";
        $desc .= nbsp(4) . ")" . "<br />";
    }
    $desc .= "[fields] => informasi fields data yang di-return-kan ";
    if ($service['type'] == singledata) {
        $desc .= "=> " . $service['fields'][0] . "<br />";
    } else {
        $desc .= "<br />";
        $desc .= nbsp(4) . "array (" . "<br />";
        $i = 0;
        foreach ($service['fields'] as $field) {
            $desc .= nbsp(8) . "[" . $i++ . "] => " . $field . "<br />";
        }
        $desc .= nbsp(4) . ")" . "<br />";
    }
    $desc .= "</blockquote>";
    $desc .= "</blockquote>";
    $ws_serv->register($method, $input, $output, $namespace, $soapaction, $style, $use, $desc);
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : "";
$ws_serv->service($HTTP_RAW_POST_DATA);
示例#13
0
文件: soap.php 项目: axoquen/tt780
        $pre = 'xsd';
        $ct = 'string';
    } else {
        if (is_integer($GLOBALS['res'])) {
            $pre = 'xsd';
            $ct = 'integer';
        } else {
            if (is_float($GLOBALS['res'])) {
                $pre = 'xsd';
                $ct = 'decimal';
            } else {
                if (is_bool($GLOBALS['res'])) {
                    $pre = 'xsd';
                    $ct = 'boolean';
                } else {
                    if (!$GLOBALS['res']) {
                        $pre = 'xsd';
                        $ct = 'string';
                        $GLOBALS['res'] = '_null_';
                    }
                }
            }
        }
    }
}
// var_error_log($res);
// error_log("{$pre}:{$ct}");
eval("\n    function {$c}(\$parameters = null) {\n        return \$GLOBALS['res'];\n    }\n");
$server->register($c, array(), array('return' => "{$pre}:{$ct}"), 'CENTER', false, 'rpc', 'encoded', 'Servicio dinamico');
$server->service($xml);
exit;
示例#14
0
<?php

include_once '../kernel.php';
$tmp_files = scandir('../web_service');
$modules = array();
$functions = array();
$functions_def = array();
foreach ($tmp_files as $fn) {
    if (strpos($fn, '.') !== 0 && $fn != '') {
        $modules[] = $fn;
        $tmp = explode('.', $fn);
        $functions[] = $tmp[0];
        $functions_def[] = $tmp[0] . '_def';
    }
}
require_once '../class/nusoap.php';
foreach ($modules as $module) {
    require_once '../web_service/' . $module;
}
$server = new soap_server();
$server->configureWSDL('test_wsdl', 'urn:test_wsdl');
$server->soap_defencoding = 'UTF-8';
foreach ($functions as $i => $function) {
    $pars = $functions_def[$i]();
    $server->register($function, $pars[0], $pars[1], $pars[2], $pars[3], $pars[4], $pars[5], $pars[6]);
}
$request = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($request);
示例#15
0
    $l_oServer->decode_utf8 = false;
    ###
    ###  IMPLEMENTATION
    ###
    # pass incoming (posted) data
    if (isset($HTTP_RAW_POST_DATA)) {
        $t_input = $HTTP_RAW_POST_DATA;
    } else {
        $t_input = implode("\r\n", file('php://input'));
    }
    # only include the MantisBT / MantisConnect related files, if the current
    # request is a webservice call (rather than webservice documentation request,
    # eg: WSDL).
    if (mci_is_webservice_call()) {
        require_once 'mc_core.php';
    } else {
        # if we have a documentation request, do some tidy up to prevent lame bot loops e.g. /mantisconnect.php/mc_enum_etas/mc_project_get_versions/
        $parts = explode('mantisconnect.php/', strtolower($_SERVER['SCRIPT_NAME']), 2);
        if (isset($parts[1]) && strlen($parts[1]) > 0) {
            echo 'This is not a SOAP webservice request, for documentation, see ' . $parts[0] . 'mantisconnect.php';
            exit;
        }
    }
    # Execute whatever is requested from the webservice.
    $l_oServer->service($t_input);
} else {
    require_once 'mc_core.php';
    $server = new SoapServer("mantisconnect.wsdl", array('features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS));
    $server->addFunction(SOAP_FUNCTIONS_ALL);
    $server->handle();
}
示例#16
0
<?php

// Pull in the NuSOAP code
require_once '../lib/nusoap.php';
// Create the server instance
$server = new soap_server();
$server->soap_defencoding = 'UTF-8';
$server->configureWSDL('load', 'urn:loadwsdl');
$server->wsdl->schemaTargetNamespace = 'urn:loadwsdl';
// enregistrement
$server->register('loadcontent', array("type" => "xsd:string", "galery" => "xsd:string"), array("result" => "xsd:base64"));
// functions
function loadcontent($type, $galery)
{
    $filename = $file . "." . $lang . ".txt";
    $handle = fopen($filename, "r");
    $contents = fread($handle, filesize($filename));
    fclose($handle);
    return utf8_encode($contents);
}
$_REQUEST = isset($_REQUEST) ? $_REQUEST : '';
$server->service($_REQUEST);
示例#17
0
<?php

require_once realpath(__DIR__ . '/../class/entityAlumno.php');
require_once realpath(__DIR__ . '/nusoap/lib/nusoap.php');
/*
 * param $idAlumno int
 * return Array
 */
function getAlumno($idAlumno)
{
    $entityAlumno = new EntityAlumno();
    return $entityAlumno->get($idAlumno);
}
function deleteAlumno($idAlumno, $user)
{
    return false;
}
$server = new soap_server();
$server->configureWSDL("Alumno", "urn:alumno");
/*nombre del servicio y el namesespace*/
$server->register("getAlumno", array("idAlumno" => "xsd:int"), array("return" => "xsd:Array"), "urn:alumno", "urn:alumno#getAlumno", "rpc", "encoded", "Mostra la informacion de un alumno por su ID");
/*descripcion del elemento*/
$server->register("deleteAlumno", array("idAlumno" => "xsd:int", "user" => "xsd:int"), array("return" => "xsd:bolean"), "urn:alumno", "urn:alumno#deleteAlumno", "rpc", "encoded", "Eimina a un alumno por su ID");
$server->service(file_get_contents("php://input"));
示例#18
0
		$selectSth 	= $dbh->prepare($sql);
		$selectSth->execute(array($name));
		$rv = $selectSth->fetchAll(PDO::FETCH_ASSOC);
		
		return json_encode($rv);
}

if(isset($_GET['soap']) && $_GET['soap']=='true') {
	//header("Content-type: application/soap+xml; charset=utf-8");

	$server = new soap_server();
	$server->configureWSDL('testapp', 'urn:testapp');

	$server->register('getdata',              // method name
		array('name' => 'xsd:string'),        // input parameters
		array('return' => 'xsd:string'),      // output parameters
		'urn:testapp',                        // namespace
		'urn:testapp#getdata',                // soapaction
		'rpc',                                // style
		'encoded',                            // use
		'Get data by name'            			// documentation
	);

	$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
	$server->service(utf8_encode($HTTP_RAW_POST_DATA));
}
else {	//simple method
	echo getdata($_GET['name']);
}

示例#19
0
文件: SOAP.php 项目: hugcoday/wiki
{
    global $server;
    checkCredentials($server, $credentials, 'view', _("HomePage"));
    $dbi = WikiDB::open($GLOBALS['DBParams']);
    require_once "lib/TextSearchQuery.php";
    $pagequery = new TextSearchQuery($pages);
    $linkquery = new TextSearchQuery($search);
    if ($linktype == 'relation') {
        $relquery = new TextSearchQuery($relation);
        $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype, $relquery);
    } elseif ($linktype == 'attribute') {
        // only numeric search withh attributes!
        $relquery = new TextSearchQuery($relation);
        require_once "lib/SemanticWeb.php";
        // search: "population > 1 million and area < 200 km^2" relation="*" pages="*"
        $linkquery = new SemanticAttributeSearchQuery($search, $relation);
        $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype, $relquery);
    } else {
        // we already do have forward and backlinks as SOAP
        $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype);
    }
    return $links->asArray();
}
$server->service($GLOBALS['HTTP_RAW_POST_DATA']);
// Local Variables:
// mode: php
// tab-width: 8
// c-basic-offset: 4
// c-hanging-comment-ender-p: nil
// indent-tabs-mode: nil
// End:
示例#20
0
 $server->register('postAlbum', array('overwriteIfExists' => 'xsd:boolean', 'artist' => 'xsd:string', 'album' => 'xsd:string', 'year' => 'xsd:int', 'asin' => 'xsd:string', 'songs' => 'tns:ArrayOfstring'), array('artist' => 'xsd:string', 'album' => 'xsd:string', 'year' => 'xsd:int', 'dataUsed' => 'xsd:boolean', 'message' => 'xsd:string'), $ns, "{$action}#postAlbum", 'rpc', 'encoded', 'Posts data for a single album including its track-list and optionally the amazon ASIN');
 $doc = 'Posts data for a single song.  If correcting exiting lyrics, ';
 $doc .= 'make sure overwriteIfExists is set to true.  In the onAlbums array, ';
 $doc .= 'if artist is left blank, it will default to the artist of the song.';
 $server->register('postSong', array('overwriteIfExists' => 'xsd:boolean', 'artist' => 'xsd:string', 'song' => 'xsd:string', 'lyrics' => 'xsd:string', 'language' => 'xsd:string', 'onAlbums' => 'tns:AlbumResultArray'), array('artist' => 'xsd:string', 'song' => 'xsd:string', 'dataUsed' => 'xsd:boolean', 'message' => 'xsd:string'), $ns, "{$action}#postSong", 'rpc', 'encoded', $doc);
 $doc .= "For the flags parameter, this is a comma-separated list of flags. ";
 $doc .= "For example, pass 'LW_SANDBOX' in to use the sandbox for testing and not actually update the site.";
 $server->register('postSong_flags', array('overwriteIfExists' => 'xsd:boolean', 'artist' => 'xsd:string', 'song' => 'xsd:string', 'lyrics' => 'xsd:string', 'onAlbums' => 'tns:AlbumResultArray', 'flags' => 'xsd:string', 'language' => 'xsd:string'), array('artist' => 'xsd:string', 'song' => 'xsd:string', 'dataUsed' => 'xsd:boolean', 'message' => 'xsd:string'), $ns, "{$action}#postSong_flags", 'rpc', 'encoded', $doc);
 ///////// UPDATING METHODS - END /////////
 //////////////////////////////////////////////////////////////////////////////
 wfDebug("LWSOAP: Done setting up SOAP functions, about to process...\n");
 // Use the request to (try to) invoke the service
 $rawPostData = file_get_contents("php://input");
 // preferred to HTTP_RAW_POST_DATA in PHP 5.6+
 wfDebug("LWSOAP: Dispatching to the ->service().\n");
 $server->service($rawPostData);
 wfDebug("LWSOAP: Returned from ->service().");
 // If the script took a long time to run, log it here.
 if ($ENABLE_LOGGING_SLOW_SOAP) {
     $scriptTime = microtime(true) - $startTime;
     if ($scriptTime >= $MIN_SECONDS_TO_LOG) {
         $fileName = "lw_SOAP_log.txt";
         if (is_writable($fileName)) {
             error_log(date("Y-m-d H:i:s") . " - {$scriptTime} - " . $_SERVER['REQUEST_URI'] . "\n", 3, $fileName);
             ob_start();
             print_r($rawPostData);
             error_log(ob_get_clean(), 3, $fileName);
         } else {
             error_log("File not writable: \"{$fileName}\"", 1, "*****@*****.**");
         }
     }
示例#21
0
<?php

// put your code here
require_once dirname(__FILE__) . '/nusoap-0.9.5/lib/nusoap.php';
function getProd($category)
{
    if ($category == "books") {
        return join(",", array("The WordPress Anthology", "PHP Master: Write Cutting Edge Code", "Build Your Own Website the Right Way"));
    } else {
        return "No products listed under that category";
    }
}
$server = new soap_server();
$server->register("getProd");
$server->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
示例#22
0
<?php

include "nusoap-0.7.3/lib/nusoap.php";
$server = new soap_server();
$server->configureWSDL('List List', 'urn:listlist');
$server->register('ListList', array("list_name" => "xsd:string"), array('return' => 'xsd:Array'), '');
function ListList($list_name)
{
    //This $url_head is to prove, is neccesary change it for url mailman adaptor of qualipso
    $url_head = "http://qualipsoweb.eurodyn.com:8000/mailman/v2.1.5/";
    $url = "" . $url_head . $list_name . "";
    $datos = fopen($url, "r");
    $contenido = fgets($datos);
    return $contenido;
}
//** ENVIAR RESULTADO SOAP POR HTTP **/
$rawPost = strcasecmp($_SERVER['REQUEST_METHOD'], "POST") == 0 ? isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input") : NULL;
$server->service($rawPost);
exit;
?>

示例#23
0
文件: server.php 项目: mermamerma/ws
$debug = 1;
$server = new soap_server();
$header = $server->requestHeaders;
$flag = doAuthenticate();
if ($flag == FALSE) {
    $server->fault(401, 'Authentication failed!');
}
$file = basename($_SERVER['PHP_SELF']);
$ns = "http://{$_SERVER['HTTP_HOST']}/ws/{$file}";
$server->configureWSDL("Web Service MPPRE-MPPEUCT", $ns);
#$server->soap_defencoding = 'UTF-8';
#$server->decode_utf8 = false;
#$server->encode_utf8 = true;
// Include con los Metodos y Tipos de Datos del WS
require_once 'wsdl.php';
$obj = new Citas();
$log = new LogDao();
// Creamos un Log de  Acceso
$log->register($header);
// Creamos un Log de Credenciales erradas
if ($flag == FALSE) {
    $log->registerBadLogin();
}
//Establecer servicio
if (isset($HTTP_RAW_POST_DATA)) {
    $input = $HTTP_RAW_POST_DATA;
} else {
    $input = implode("rn", file('php://input'));
}
$server->service($input);
示例#24
0
$servicesStat = (object) stat(constant('WS_ENABLE_PATH'));
if (!isset($_SESSION[$icmbioAppDomain]['ws_lastUpdate']) || $_SESSION[$icmbioAppDomain]['ws_lastUpdate'] < $servicesStat->mtime) {
    # abre o o repositorio de servico
    if ($dh = opendir('./services-enable')) {
        while (($file = readdir($dh)) !== FALSE) {
            if ($file == "." || $file == ".." || pathinfo($file, PATHINFO_EXTENSION) != 'php') {
                continue;
            }
            require constant('WS_ENABLE_PATH') . $file;
        }
    } else {
        die('<h2>Servi&ccedil;o indispon&iacute;vel</h2><h2>Service unavailable</h2>');
    }
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$ICMBioWSservice->service($HTTP_RAW_POST_DATA);
/**
 * exibe o conteudo do objeto informado bem como a pilha
 * de execução até o ponto de chamada desta função
 *
 * @param  mixed
 * @param  boolean
 * @param  boolean
 */
function dump($obj, $exit = TRUE, $outputRaw = TRUE)
{
    $trace = array();
    $backtrace = debug_backtrace();
    $totalCall = sizeof($backtrace);
    for ($i = 0; $i < $totalCall; $i++) {
        if (!$i) {
示例#25
0
<?php

include_once 'lib/nusoap.php';
$servicio = new soap_server();
$ns = "urn:miserviciowsdl";
$servicio->configureWSDL("MiPrimerServicioWeb", $ns);
$servicio->schemaTargetNamespace = $ns;
$servicio->register("MiFuncion", array('fecha' => 'xsd:string', 'componente' => 'xsd:string', 'probabilidad' => 'xsd:float'), array('return' => 'xsd:string'), $ns);
function MiFuncion($fecha, $componente, $probabilidad)
{
    $resultadoDisponibilidad = $probabilidad * 100;
    $resultado = "La dispnibilidad del componente " . $componente . " en la fecha: " . $fecha . " es: " . $resultadoDisponibilidad . "% calculado desde el servicio web de Conexion";
    $respuesta = array('frase' => $resultado, 'probabilidad' => $resultadoDisponibilidad);
    return json_encode($respuesta);
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$servicio->service($HTTP_RAW_POST_DATA);
示例#26
0
    if ($result) {
        return TRUE;
    } else {
        return FALSE;
    }
}
function update($id, $name, $address, $age, $phone)
{
    $con = mysqli_connect('localhost', 'root', 'marwek', 'trying');
    $query = "UPDATE \n\t\t\t\thuman \n\t\t\t  SET \n\t\t\t  \tname \t= '{$name}',\n\t\t\t  \taddress = '{$address}',\n\t\t\t  \tage \t= '{$age}',\n\t\t\t  \tphone\t= '{$phone}'\n\t\t\t  WHERE \n\t\t\t  \tid \t\t= '{$id}'";
    $result = mysqli_query($con, $query);
    if ($result) {
        return TRUE;
    } else {
        return FALSE;
    }
}
function delete($id)
{
    $con = mysqli_connect('localhost', 'root', 'marwek', 'trying');
    $query = "DELETE FROM human WHERE id = '{$id}'";
    $result = mysqli_query($con, $query);
    if ($result) {
        return TRUE;
    } else {
        return FALSE;
    }
}
$rawPostData = file_get_contents('php://input');
$serverPetugas->service($rawPostData);
示例#27
0
    mssql_free_statement($sp);
    //Liberación del recurso
    return $sResultado;
}
//Función que devuelve uno o varios valores específicos de la tabla dbo.Paises
//Creation Date: 22-01-2016
function ReaPaises($nIdPais)
{
    $sp = mssql_init('REAPAISES');
    //SP
    //Parámetros SP
    mssql_bind($sp, '@nIdPais', $nIdPais, SQLINT4);
    $resultado = mssql_execute($sp);
    //Ejecución SP
    $i = 0;
    while ($row = mssql_fetch_array($resultado)) {
        $html[$i]['id_pais'] = $row[0];
        $html[$i]['nombre'] = $row[1];
        $i++;
    }
    return $html;
    mssql_free_result($resultado);
    //Liberación del recurso
    mssql_free_statement($sp);
    //Liberación del recurso
}
//$HTTP_RAW_POST_DATA=isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : "";
//$server->service($HTTP_RAW_POST_DATA);
$httpPost = file_get_contents('php://input');
$server->service($httpPost);
示例#28
0
 function PresentWSDL($ServiceObject, $ServiceTitle)
 {
     if (get_class($ServiceObject) == "DispatchService") {
         return $ServiceObject->PresentWSDL();
     }
     $ServiceTitle = substr($ServiceTitle, 0, strlen($ServiceTitle) - strlen("Service"));
     if (method_exists($ServiceObject, "Help")) {
         $Documentation = $ServiceObject->Help();
     } else {
         $Documentation = null;
     }
     if (method_exists($ServiceObject, "In")) {
         $In = $ServiceObject->In();
     }
     if (method_exists($ServiceObject, "Out")) {
         $Out = $ServiceObject->Out();
     }
     $In = $this->TypeArray2WSDLTypes($In);
     $Out = $this->TypeArray2WSDLTypes($Out);
     j::$App->LoadSystemModule("plugin.nusoap.nusoap");
     $soap = new soap_server();
     $Namespace = SiteRoot . constant("jf_jPath_Request_Delimiter") . "service" . constant("jf_jPath_Request_Delimiter");
     //		$Endpoint=$Namespace."dispatch";
     $Endpoint = jURL::URL(false);
     //SoapClients use this to send request!
     $soap->configureWSDL($ServiceTitle, $Namespace, $Endpoint);
     //			$Namespace);
     $soap->register($ServiceTitle, $In, $Out, $Namespace, $SoapAction = $ServiceTitle, null, null, nl2br($Documentation), null);
     $soap->service("");
     return true;
 }
        $seed_user = new Users();
        $user_id = $seed_user->retrieve_user_id($user_name);
        $current_user = $seed_user;
        $current_user->retrieve_entity_info($user_id, "Users");
        if (isPermitted("Contacts", "index") == "yes") {
            return "allowed";
        } else {
            return "contact";
        }
    }
}
function CheckLeadViewPerm($user_name)
{
    global $current_user, $log;
    require_once 'modules/Users/Users.php';
    $seed_user = new Users();
    $user_id = $seed_user->retrieve_user_id($user_name);
    $current_user = $seed_user;
    $current_user->retrieve_entity_info($user_id, "Users");
    if (isPermitted("Leads", "EditView") == "yes") {
        return "allowed";
    } else {
        return "denied";
    }
}
/* Begin the HTTP listener service and exit. */
if (!isset($HTTP_RAW_POST_DATA)) {
    $HTTP_RAW_POST_DATA = file_get_contents('php://input');
}
$server->service($HTTP_RAW_POST_DATA);
exit;
示例#30
0
 function create_page()
 {
     $s = new soap_server();
     $s->register('CAMILA_SOAP_deck.GetTasks');
     $s->service(file_get_contents('php://input'));
 }