configureWSDL('componentwsdl', 'urn:componentwsdl'); // Put the WSDL schema types in the namespace with the tns prefix $server->wsdl->schemaTargetNamespace = 'urn:component'; // Register the data structures used by the service //Definimos la estructura de la matriz que usa los registros $server->wsdl->addComplexType( 'ComponentInput', 'complexType', 'struct', 'all', '', array( 'usuario' => array('name' => 'usuario', 'type' => 'xsd:string'), 'componente' => array('name' => 'componente', 'type' => 'xsd:int') ) ); $server->wsdl->addComplexType( 'ComponentOutput', 'complexType', 'struct', 'all', '', array( 'id_componente' => array('name' => 'id_componente', 'type' => 'xsd:int'), 'id_tipo_componente' => array('name' => 'id_tipo_componente', 'type' => 'xsd:int'), 'componente' => array('name' => 'componente', 'type' => 'xsd:string'), 'pagina' => array('name' => 'pagina', 'type' => 'xsd:string'), 'carpeta' => array('name' => 'carpeta', 'type' => 'xsd:string'), 'orden' => array('name' => 'orden', 'type' => 'xsd:int'), ) ); /*$server->wsdl->addComplexType( 'Contact', 'complexType', 'struct', 'all', '', array( 'contact' => array('name' => 'contact', 'type' => 'xsd:string'), 'email' => array('name' => 'email', 'type' => 'xsd:string'), ) ); */ $server->wsdl->addComplexType( 'ComponentArray', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:ComponentOutput[]')), 'tns:ComponentOutput' ); /*$server->wsdl->addComplexType( 'ContactArray', 'complexType', 'array','', 'SOAP-ENC:Array', array(), array( array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Contact[]') ), 'tns:Contact' ); */ // Register the method to expose $server->register( 'component', // method name array('componentInput' => 'tns:ComponentInput'), // input parameters array('return' => 'tns:ComponentArray'), // output parameters 'urn:componentwsdl', // namespace 'urn:componentwsdl/component', // soapaction 'rpc', // style 'encoded', // use 'Funcion para retornar los componentes de acuerdo a un usuario' // documentation ); /* $server->register( 'getAutocompleteContacts', array('email' => 'xsd:string', 'num' => 'xsd:int', 'token' => 'xsd:string'), // input parameters array('return' => 'tns:ContactArray'), 'urn:'.$_SERVER['SCRIPT_URI'], // namespace 'urn:'.$_SERVER['SCRIPT_URI'].'#getAutocompleteContacts', // soapaction 'rpc', // style 'encoded', // use 'Fetch array of address book contacts for use in autocomplete' ); // documentation */ function component($componentInput) { global $conectar; $db = pg_connect($conectar); $sql = "select id_componente, id_tipo_componente, componente, pagina, carpeta, orden from ase.ase_consulta_acciones ('".$componentInput['usuario']."', '".$componentInput['componente']."')"; $rs = pg_exec($db,$sql); $num_reg = pg_numrows($rs); $tabla=array(); for ($i=0; $i<$num_reg; $i++) { $tabla[] = pg_fetch_array ($rs); /* $id_componente[$i] = $row['id_componente']; $id_tipo_componente[$i] = $row['id_tipo_componente']; $componente[$i] = $row['componente']; $pagina[$i] = $row['pagina']; $carpeta[$i] = $row['carpeta']; $orden[$i] = $row['orden'];*/ } pg_close($db); /*return array( 'id_componente' => $id_componente, 'id_tipo_componente' => $id_tipo_componente, 'componente' => $componente, 'pagina' => $pagina, 'carpeta' => $carpeta, 'orden' => $orden );*/ return $tabla; //return $id_componente; } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?>