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); }
public static function crearWebServiceUntis() { $nusoap_server = new soap_server(); $nusoap_server->configureWSDL('Transferir archivo Untis', 'urn:transferir_archivo_untis'); // Parametros de entrada $nusoap_server->wsdl->addComplexType('datos_entrada', 'complexType', 'struct', 'all', '', array('archivo' => array('name' => 'Archivo', 'type' => 'xsd:base64Binary'))); // Parametros de Salida $nusoap_server->wsdl->addComplexType('datos_salida', 'complexType', 'struct', 'all', '', array('mensaje' => array('name' => 'mensaje', 'type' => 'xsd:string'))); $nusoap_server->wsdl->addComplexType('anio_lectivo_salida', 'complexType', 'struct', 'all', '', array('mensaje' => array('name' => 'mensaje', 'type' => 'xsd:string'))); $nusoap_server->register('enviar_xml', array('datos_entrada' => 'tns:datos_entrada'), array('return' => 'tns:datos_salida'), 'urn:transferir_archivo_untis', 'urn:hellowsdl2#enviar_xml', 'rpc', 'encoded', 'La siguiente funcion recibe un archivo y transfiere los datos al servidor'); $nusoap_server->register('consultar_anio_lectivo_activo', array('datos_entrada' => ''), array('return' => 'tns:anio_lectivo_salida'), 'urn:transferir_archivo_untis', 'urn:hellowsdl3#consultar_anio_lectivo_activo', 'rpc', 'encoded', 'La siguiente funcion envia el año lectivo activo'); return $nusoap_server; }
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")); }
/** * Singleton method */ public static function singleton() { if (!isset(self::$_instance)) { self::$_instance = new soap_server(); // Set the error handler WSCMError::setErrorHandler(new WSCMSoapErrorHandler()); // Configure the service self::$_instance->configureWSDL('WSCMService', 'urn:WSCMService'); } return self::$_instance; }
public function PresentWSDL() { $Namespace = SiteRoot . constant("jf_jPath_Request_Delimiter") . "service" . constant("jf_jPath_Request_Delimiter"); $Endpoint = HttpRequest::URL(false); //SoapClients use this to send request! j::$App->LoadSystemModule("plugin.nusoap.nusoap"); $soap = new soap_server(); $soap->configureWSDL("Dispatch", $Namespace, $Endpoint); // $Namespace); $r = $this->ListFiles(dirname(__FILE__)); foreach ($r as $k => $v) { $this->Register($this->File2Class($v), $soap, $Namespace); } $soap->service(""); return true; }
function NusoapResponse() { // force to set global variable $debug // before calling parent constructor $GLOBALS['debug'] = $this->mDebugMode; parent::soap_server(); $this->configureWsdl(__CLASS__ . 'Service', FALSE, $this->mEndpoint); $this->mrDispatcher = Dispatcher::Instance(); $this->mrSecurity = Security::Instance(); $this->mrSession = Session::Instance(); if (!empty($this->mRegisteredFunctions)) { foreach ($this->mRegisteredFunctions as $func_name => $params) { if (is_array($params) && $params != NULL) { $this->register($func_name, $params['in'], $params['out'], $params['namespace'], $params['soapaction'], $params['style'], $params['use'], $params['documentation'], $params['encodingStyle']); } else { $this->register($func_name); } } } if (!empty($this->mRegisteredTypes)) { foreach ($this->mRegisteredTypes as $type_name => $params) { if (is_array($params) && count($params) > 0) { if ($params['type'] == 'complexType' && $params['phptype'] != 'scalar') { $this->wsdl->addComplexType($type_name, $params['type'], $params['phptype'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arraytype']); } else { $this->wsdl->addSimpleType($type_name, $params['type'], $params['phptype'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arraytype']); } } else { $this->register($func_name); } } } $this->wsdl->addComplexType('ListType', 'complexType', 'array'); $this->wsdl->addComplexType('AgmListType', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:integer[]')), 'xsd:integer'); }
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')); }
function createServer() { // ************************************************************************************* // create the server instance // ************************************************************************************* $server = new soap_server(); $server->xml_encoding = "UTF-8"; $server->decode_utf8 = false; $server->configureWSDL('DOMAService', NAMESPACE1); // ************************************************************************************* // define complex types // ************************************************************************************* $server->wsdl->addComplexType('PublishMapRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string'), 'MapInfo' => array('name' => 'Map', 'type' => 'tns:MapInfo'))); $server->wsdl->addComplexType('PublishMapResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'URL' => array('name' => 'URL', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('PublishPreUploadedMapRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string'), 'MapInfo' => array('name' => 'Map', 'type' => 'tns:MapInfo'), 'PreUploadedMapImageFileName' => array('name' => 'PreUploadedMapImageFileName', 'type' => 'xsd:string'), 'PreUploadedBlankMapImageFileName' => array('name' => 'PreUploadedBlankMapImageFileName', 'type' => 'xsd:string'), 'PreUploadedThumbnailImageFileName' => array('name' => 'PreUploadedThumbnailImageFileName', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('PublishPreUploadedMapResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'URL' => array('name' => 'URL', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('UploadPartialFileRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string'), 'FileName' => array('name' => 'FileName', 'type' => 'xsd:string'), 'Data' => array('name' => 'Data', 'type' => 'xsd:base64Binary'))); $server->wsdl->addComplexType('UploadPartialFileResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'FileName' => array('name' => 'FileName', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('GetAllMapsRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('GetAllMapsResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'Maps' => array('name' => 'Maps', 'type' => 'tns:MapInfoArray'))); $server->wsdl->addComplexType('GetAllCategoriesRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('GetAllCategoriesResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'Categories' => array('name' => 'Categories', 'type' => 'tns:CategoryArray'))); $server->wsdl->addComplexType('ConnectRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('ConnectResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'Version' => array('name' => 'Version', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('MapInfo', 'complexType', 'struct', 'all', '', array('ID' => array('name' => 'ID', 'type' => 'xsd:int'), 'UserID' => array('name' => 'UserID', 'type' => 'xsd:int'), 'CategoryID' => array('name' => 'CategoryID', 'type' => 'xsd:int'), 'Date' => array('name' => 'Date', 'type' => 'xsd:dateTime'), 'Name' => array('name' => 'Name', 'type' => 'xsd:string'), 'Organiser' => array('name' => 'Organiser', 'type' => 'xsd:string'), 'Country' => array('name' => 'Country', 'type' => 'xsd:string'), 'Discipline' => array('name' => 'Discipline', 'type' => 'xsd:string'), 'RelayLeg' => array('name' => 'RelayLeg', 'type' => 'xsd:string'), 'MapName' => array('name' => 'MapName', 'type' => 'xsd:string'), 'ResultListUrl' => array('name' => 'ResultListUrl', 'type' => 'xsd:string'), 'Comment' => array('name' => 'Comment', 'type' => 'xsd:string'), 'MapImageData' => array('name' => 'MapImageData', 'type' => 'xsd:base64Binary'), 'MapImageFileExtension' => array('name' => 'MapImageFileExtension', 'type' => 'xsd:string'), 'BlankMapImageData' => array('name' => 'BlankMapImageData', 'type' => 'xsd:base64Binary'))); $server->wsdl->addComplexType('Category', 'complexType', 'struct', 'all', '', array('ID' => array('name' => 'ID', 'type' => 'xsd:int'), 'UserID' => array('name' => 'UserID', 'type' => 'xsd:int'), 'Name' => array('name' => 'Name', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('MapInfoArray', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:MapInfo[]')), 'tns:MapInfo'); $server->wsdl->addComplexType('CategoryArray', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:Category[]')), 'tns:Category'); // ************************************************************************************* // register service methods // ************************************************************************************* $server->register('PublishMap', array('request' => 'tns:PublishMapRequest'), array('response' => 'tns:PublishMapResponse'), NAMESPACE1); $server->register('PublishPreUploadedMap', array('request' => 'tns:PublishPreUploadedMapRequest'), array('response' => 'tns:PublishPreUploadedMapResponse'), NAMESPACE1); $server->register('UploadPartialFile', array('request' => 'tns:UploadPartialFileRequest'), array('response' => 'tns:UploadPartialFileResponse'), NAMESPACE1); $server->register('GetAllMaps', array('request' => 'tns:GetAllMapsRequest'), array('response' => 'tns:GetAllMapsResponse'), NAMESPACE1); $server->register('GetAllCategories', array('request' => 'tns:GetAllCategoriesRequest'), array('response' => 'tns:GetAllCategoriesResponse'), NAMESPACE1); $server->register('Connect', array('request' => 'tns:ConnectRequest'), array('response' => 'tns:ConnectResponse'), NAMESPACE1); return $server; }
$banco = Cuenta::first('all', array('conditions' => array(' nro_afiliado = ?', $nro_afiliado))); // var_dump($client->nombre); if ($client != NULL && $tarjeta != NULL && $banco != NULL) { $cuentaCliente = Cuenta::first('all', array('conditions' => array(' ci_cliente = ?', $ci))); if ($cuentaCliente->nro_afiliado == $tarjeta->nro_afiliado && $cod_seg == $tarjeta->cod_seg) { if ($monto <= $cuentaCliente->saldo) { $cuentaCliente->saldo = $cuentaCliente->saldo - $monto; $cuentaCliente->save(); $banco->saldo = $banco->saldo + $monto; $banco->save(); Transaccion::create(array('nro_tarjeta' => $nro_tarjeta, 'ci' => $ci, 'fecha_transaccion' => date("Y-m-d H:i:s"), 'monto' => $monto, "nro_afiliado_adquiriente" => $nro_afiliado, 'cod' => "00")); return "00"; } else { Transaccion::create(array('nro_tarjeta' => $nro_tarjeta, 'ci' => $ci, 'fecha_transaccion' => date("Y-m-d H:i:s"), 'monto' => $monto, "nro_afiliado_adquiriente" => $nro_afiliado, 'cod' => "01")); return "01"; } } else { Transaccion::create(array('nro_tarjeta' => $nro_tarjeta, 'ci' => $ci, 'fecha_transaccion' => date("Y-m-d H:i:s"), 'monto' => $monto, "nro_afiliado_adquiriente" => $nro_afiliado, 'cod' => "10")); return "10"; } } else { Transaccion::create(array('nro_tarjeta' => $nro_tarjeta, 'ci' => $ci, 'fecha_transaccion' => date("Y-m-d H:i:s"), 'monto' => $monto, "nro_afiliado_adquiriente" => $nro_afiliado, 'cod' => "10")); return "10"; } } // Se inicializa el servidor. $server = new soap_server(); $server->configureWSDL("BancoTere", "urn:BancoTere"); $server->register('pago', array("nro_tarjeta" => "xsd:int", "cod_seg" => "xsd:string", "fecha_exp" => "xsd:string", "monto" => "xsd:string", "ci" => "xsd:int", "nro_afiliado" => "xsd:int"), array("return" => "xsd:string"), 'urn:BancoTere', 'urn:BancoTere#pago', 'rpc', 'encoded', 'transacion del banco'); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
<?php require_once 'biblioteca/lib/nusoap.php'; //Create a new soap server $server = new soap_server(); $URL = "http:localhost:80/servidor"; $namespace = $URL . '?wsdl'; //using soap_server to create server object $server = new soap_server(); $server->configureWSDL('servidor', $namespace); //Define our namespace /*$server->wsdl->addComplexType( 'Person', 'complexType', 'struct', 'all', '', array( 'id_user' => array('name' => 'id_user', 'type' => 'xsd:int')) ); */ //first simple function $server->register('insertar_persona', array('cedula' => 'xsd:string', 'nombre' => 'xsd:string', 'apellido' => 'xsd:string', 'ruc' => 'xsd:string', 'direccion' => 'xsd:string', 'email' => 'xsd:string', 'telefono' => 'xsd:string', 'fecha' => 'xsd:date', 'ventana' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:Servidor.insertar_persona', 'urn:Servidor.insertar_persona', 'rpc', 'encoded', 'Se inserta en personas'); $server->register('insertar_anamnesis', array('cedula' => 'xsd:string', 'motivo_consulta' => 'xsd:string', 'antecedentes_familiares' => 'xsd:string', 'antecedentes_desarrollo' => 'xsd:string', 'aspectos_generales' => 'xsd:string', 'conclusiones' => 'xsd:string', 'observaciones' => 'xsd:string', 'plan_evaluacion' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:Servidor.insertar_anamnesis', 'urn:Servidor.insertar_anamnesis', 'rpc', 'encoded', 'Se inserta el anamnesis'); $server->register('recuperar_paciente', array('cedula' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:Servidor.recuperar_paciente', 'urn:Servidor.recuperar_paciente', 'rpc', 'encoded', 'Just say hello'); $server->register('recuperar_medico', array('cedula' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:Servidor.recuperar_medico', 'urn:Servidor.recuperar_medico', 'rpc', 'encoded', 'Recuperar'); $server->register('verificar_persona', array('cedula' => 'xsd:string'), array('return' => 'xsd:boolean'), 'urn:Servidor.verificar_persona', 'urn:Servidor.verificar_persona', 'rpc', 'encoded', 'Verificar'); $server->register('facturar', array('fecha' => 'xsd:date', 'iva' => 'xsd:numeric', 'total' => 'xsd:numeric', 'usuario' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:Servidor.facturar', 'urn:Servidor.facturar', 'rpc', 'encoded', 'Facturar'); $server->register('facturar2', array('cedulaP' => 'xsd:string', 'cedulaM' => 'xsd:string', 'fecha' => 'xsd:date', 'horario' => 'xsd:time', 'direccion' => 'xsd:string', 'cantidadH' => 'xsd:integer', 'iva' => 'xsd:numeric', 'total' => 'xsd:numeric', 'usuario' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:Servidor.facturar2', 'urn:Servidor.facturar2', 'rpc', 'encoded', 'Facturar2'); $server->register('verificar_fecha', array('cedulaP' => 'xsd:string', 'cedulaM' => 'xsd:string', 'fecha' => 'xsd:date', 'horario' => 'xsd:time'), array('return' => 'xsd:string'), 'urn:Servidor.verificar_fecha', 'urn:Servidor.verificar_fecha', 'rpc', 'encoded', 'Verificar fecha');
# Copyright (C) 2004-2007 Victor Boctor - vboctor@users.sourceforge.net # This program is distributed under dual licensing. These include # GPL and a commercial licenses. Victor Boctor reserves the right to # change the license of future releases. # See docs/ folder for more details # -------------------------------------------------------- # $Id: mantisconnect.php,v 1.1 2007-07-18 06:52:47 vboctor Exp $ # -------------------------------------------------------- $t_current_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $t_nusoap_dir = $t_current_dir . 'nusoap'; # includes nusoap classes chdir($t_nusoap_dir); require_once 'nusoap.php'; chdir($t_current_dir); # create server $l_oServer = new soap_server(); # namespace $t_namespace = 'http://futureware.biz/mantisconnect'; # wsdl generation $l_oServer->debug_flag = false; $l_oServer->configureWSDL('MantisConnect', $t_namespace); $l_oServer->wsdl->schemaTargetNamespace = $t_namespace; // The following will make the default encoding UTF-8 instead of ISO-8859-1 // WS-I Basic Profile requires UTF-8 or UTF-16 as the encoding for interoperabilty // reasons. This will correctly handle a large number of languages besides English. $l_oServer->xml_encoding = "UTF-8"; $l_oServer->soap_defencoding = "UTF-8"; $l_oServer->decode_utf8 = false; ### ### PUBLIC TYPES ###
<?php //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
<?php //incluimos la clase nusoap.php require_once './lib/nusoap.php'; require_once './lib/class.wsdlcache.php'; //creamos el objeto de tipo soap_server $ns = "http://vlana001sw.esy.es/SistemasWeb/Lab7/php"; $server = new soap_server(); $server->configureWSDL('passVal', $ns); $server->wsdl->schemaTargetNamespace = $ns; //registramos la función que vamos a implementar $server->register('passVal', array('password' => 'xsd:String'), array('x' => 'xsd:String'), $ns); //implementamos la función function passVal($password) { $file = fopen("../txt/toppasswords.txt", "r") or die("Error al abrir el fichero toppasswords.txt"); while (!feof($file)) { $line = fgets($file); if (strcmp(substr($line, 0, strlen($line) - 2), $password) == 0) { fclose($file); return "INVALIDA"; } } fclose($file); return "VALIDA"; } //llamamos al método service de la clase nusoap $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
<?php // Pull in the NuSOAP code require_once 'lib/nusoap.php'; // Create the server instance $server = new soap_server(); // Initialize WSDL support $server->configureWSDL('commandinjwsdl', 'urn:commandinjwsdl'); // Register the method to expose $server->register('commandinj', array('command' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:commandinjwsdl', 'urn:commandinjwsdl#commandinj', 'rpc', 'encoded', 'Returns the results of a command'); // Define the method as a PHP function function commandinj($command) { exec($command, $output); $results = ""; while (list($key, $val) = each($output)) { $results = $results . $val; } return $results; } // Use the request to (try to) invoke the service $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
require_once 'modules/Emails/mail.php'; require_once 'modules/Users/Users.php'; require_once 'modules/Settings/CustomerPortal/helpers/CustomerPortalPassword.php'; ini_set('error_log', $root_directory . 'cache/logs/yetiportal.log'); /** Configure language for server response translation */ $current_language = vglobal('current_language'); if (!isset($current_language)) { $current_language = vglobal('default_language'); } $log =& LoggerManager::getLogger('portal'); $userid = getPortalUserid(); $user = new Users(); $current_user = $user->retrieveCurrentUserInfoFromFile($userid); //error_reporting(0); $NAMESPACE = 'http://www.yetiforce.com'; $server = new soap_server(); $server->configureWSDL('customerportal'); $server->wsdl->addComplexType('common_array', 'complexType', 'array', '', array('fieldname' => array('name' => 'fieldname', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('common_array1', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:common_array[]')), 'tns:common_array'); $server->wsdl->addComplexType('add_contact_detail_array', 'complexType', 'array', '', array('salutation' => array('name' => 'salutation', 'type' => 'xsd:string'), 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), 'mobile' => array('name' => 'mobile', 'type' => 'xsd:string'), 'parentid' => array('name' => 'parentid', 'type' => 'xsd:string'), 'leadsource' => array('name' => 'leadsource', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('field_details_array', 'complexType', 'array', '', array('fieldlabel' => array('name' => 'fieldlabel', 'type' => 'xsd:string'), 'fieldvalue' => array('name' => 'fieldvalue', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('field_datalist_array', 'complexType', 'array', '', array('fielddata' => array('name' => 'fielddata', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('product_list_array', 'complexType', 'array', '', array('productid' => array('name' => 'productid', 'type' => 'xsd:string'), 'productname' => array('name' => 'productname', 'type' => 'xsd:string'), 'productcode' => array('name' => 'productcode', 'type' => 'xsd:string'), 'commissionrate' => array('name' => 'commissionrate', 'type' => 'xsd:string'), 'qtyinstock' => array('name' => 'qtyinstock', 'type' => 'xsd:string'), 'qty_per_unit' => array('name' => 'qty_per_unit', 'type' => 'xsd:string'), 'unit_price' => array('name' => 'unit_price', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('get_ticket_attachments_array', 'complexType', 'array', '', array('files' => array('fileid' => 'xsd:string', 'type' => 'tns:xsd:string', 'filename' => 'xsd:string', 'type' => 'tns:xsd:string', 'filesize' => 'xsd:string', 'type' => 'tns:xsd:string', 'filetype' => 'xsd:string', 'type' => 'tns:xsd:string', 'filecontents' => 'xsd:string', 'type' => 'tns:xsd:string'))); $server->register('authenticate_user', array('fieldname' => 'tns:common_array'), array('return' => 'tns:common_array'), $NAMESPACE); $server->register('change_password', array('fieldname' => 'tns:common_array'), array('return' => 'tns:common_array'), $NAMESPACE); $server->register('create_ticket', array('fieldname' => 'tns:common_array'), array('return' => 'tns:common_array'), $NAMESPACE); //for a particular contact ticket list $server->register('get_tickets_list', array('fieldname' => 'tns:common_array'), array('return' => 'tns:common_array'), $NAMESPACE); $server->register('get_ticket_comments', array('fieldname' => 'tns:common_array'), array('return' => 'tns:common_array'), $NAMESPACE); $server->register('get_combo_values', array('fieldname' => 'tns:common_array'), array('return' => 'tns:common_array'), $NAMESPACE);
<?php //header('content-type: application/json; charset=utf-8'); //header("acces-control-allow-origin:*"); header("Access-Control-Allow-Origin: *"); require_once "nusoap-0.9.5/lib/nusoap.php"; include '../webServices/Conexion_BD/open_conexion_sql.php'; $server = new soap_server(); $ns = "urn:MommyService"; $server->configureWSDL("MommyService", $ns); $server->schemaTargetNamespace = $ns; $server->xml_encoding = "utf-8"; $server->soap_defencoding = "utf-8"; include '../webServices/ComplexityTypes/complexityTypes.php'; include '../webServices/Registers/wsdl_registers.php'; function ValidarLogin($id, $pass) { $respuesa = ""; if ($id == "mommy" && $pass == "123") { $respuesa = "ok"; } else { $respuesa = "no"; } return $respuesa; } function EjecutarSQL($comando) { $comando = "SELECT id_pais,nombre FROM dbo.Paises"; $resultado = mssql_query($comando) or die("ERROR CONSULTA SQL"); $i = 0; while ($row = mssql_fetch_array($resultado)) {
<?php $no_gz_buffer = true; // 0. Include GForge files for access to GForge system require_once '../env.inc.php'; require_once $gfwww . 'include/squal_pre.php'; require_once $gfcommon . 'include/gettext.php'; $uri = 'http://' . $sys_default_domain; // 1. include client and server require_once $gfwww . 'soap/nusoap.php'; //$debug = true; // 2. instantiate server object $server = new soap_server(); //configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http'); //$server->configureWSDL('GForgeAPI',$uri); $server->configureWSDL('GForgeAPI', $uri, false, 'rpc', 'http://schemas.xmlsoap.org/soap/http', $uri); // add types $server->wsdl->addComplexType('ArrayOfstring', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:string[]')), 'xsd:string'); $server->wsdl->addComplexType('ArrayOfInteger', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:integer[]')), 'xsd:integer'); $server->wsdl->addComplexType('ArrayOflong', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:long[]')), 'xsd:long'); $server->wsdl->addComplexType('ArrayOfint', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:int[]')), 'xsd:int'); // session/authentication $server->register('login', array('userid' => 'xsd:string', 'passwd' => 'xsd:string'), array('loginResponse' => 'xsd:string'), $uri, $uri . '#login'); $server->register('logout', array('session_ser' => 'xsd:string'), array('logoutResponse' => 'xsd:string'), $uri, $uri . '#logout'); // // Include Group Functions // require_once $gfwww . 'soap/common/group.php'; // // Include User Functions //
<?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);
* The Initial Developer of the Original Code is vtiger. * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. * ********************************************************************************/ /** * URL Verfication - Required to overcome Apache mis-configuration and leading to shared setup mode. */ require_once 'config/config.php'; include_once 'vtlib/Vtiger/Module.php'; include_once 'include/main/WebUI.php'; require_once 'libraries/nusoap/nusoap.php'; $log =& LoggerManager::getLogger('wordplugin'); error_reporting(0); $NAMESPACE = 'http://www.yetiforce.com'; $server = new soap_server(); $accessDenied = "You are not permitted to perform this action"; $server->configureWSDL('vtigersoap'); $server->wsdl->addComplexType('contact_column_detail', 'complexType', 'array', '', array('email_address' => array('name' => 'email_address', 'type' => 'xsd:string'), 'first_name' => array('name' => 'first_name', 'type' => 'xsd:string'), 'last_name' => array('name' => 'last_name', 'type' => 'xsd:string'), 'primary_address_city' => array('name' => 'primary_address_city', 'type' => 'xsd:string'), 'account_name' => array('name' => 'account_name', 'type' => 'xsd:string'), 'id' => array('name' => 'id', 'type' => 'xsd:string'), 'salutation' => array('name' => 'salutation', 'type' => 'xsd:string'), 'title' => array('name' => 'title', 'type' => 'xsd:string'), 'phone_mobile' => array('name' => 'phone_mobile', 'type' => 'xsd:string'), 'reports_to' => array('name' => 'reports_to', 'type' => 'xsd:string'), 'primary_address_city' => array('name' => 'primary_address_city', 'type' => 'xsd:string'), 'primary_address_street' => array('name' => 'primary_address_street', 'type' => 'xsd:string'), 'primary_address_state' => array('name' => 'primary_address_state', 'type' => 'xsd:string'), 'primary_address_postalcode' => array('name' => 'primary_address_postalcode', 'type' => 'xsd:string'), 'primary_address_country' => array('name' => 'primary_address_country', 'type' => 'xsd:string'), 'alt_address_city' => array('name' => 'alt_address_city', 'type' => 'xsd:string'), 'alt_address_street' => array('name' => 'alt_address_street', 'type' => 'xsd:string'), 'alt_address_state' => array('name' => 'alt_address_state', 'type' => 'xsd:string'), 'alt_address_postalcode' => array('name' => 'alt_address_postalcode', 'type' => 'xsd:string'), 'alt_address_country' => array('name' => 'alt_address_country', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('account_column_detail', 'complexType', 'array', '', array('accountid' => array('name' => 'accountid', 'type' => 'xsd:string'), 'accountname' => array('name' => 'accountname', 'type' => 'xsd:string'), 'parentid' => array('name' => 'parentid', 'type' => 'xsd:string'), 'account_type' => array('name' => 'account_type', 'type' => 'xsd:string'), 'industry' => array('name' => 'industry', 'type' => 'xsd:string'), 'annualrevenue' => array('name' => 'annualrevenue', 'type' => 'xsd:string'), 'rating' => array('name' => 'rating', 'type' => 'xsd:string'), 'ownership' => array('name' => 'ownership', 'type' => 'xsd:string'), 'siccode' => array('name' => 'siccode', 'type' => 'xsd:string'), 'tickersymbol' => array('name' => 'tickersymbol', 'type' => 'xsd:string'), 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), 'otherphone' => array('name' => 'otherphone', 'type' => 'xsd:string'), 'email1' => array('name' => 'email1', 'type' => 'xsd:string'), 'email2' => array('name' => 'email2', 'type' => 'xsd:string'), 'website' => array('name' => 'website', 'type' => 'xsd:string'), 'fax' => array('name' => 'fax', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('lead_column_detail', 'complexType', 'array', '', array('id' => array('name' => 'id', 'type' => 'xsd:string'), 'date_entered' => array('name' => 'date_entered', 'type' => 'xsd:string'), 'date_modified' => array('name' => 'date_modified', 'type' => 'xsd:string'), 'modified_user_id' => array('name' => 'modified_user_id', 'type' => 'xsd:string'), 'assigned_user_id' => array('name' => 'assigned_user_id', 'type' => 'xsd:string'), 'salutation' => array('name' => 'salutation', 'type' => 'xsd:string'), 'first_name' => array('name' => 'first_name', 'type' => 'xsd:string'), 'last_name' => array('name' => 'last_name', 'type' => 'xsd:string'), 'company' => array('name' => 'company', 'type' => 'xsd:string'), 'designation' => array('name' => 'designation', 'type' => 'xsd:string'), 'lead_source' => array('name' => 'lead_source', 'type' => 'xsd:string'), 'industry' => array('name' => 'industry', 'type' => 'xsd:string'), 'annual_revenue' => array('name' => 'annual_revenue', 'type' => 'xsd:string'), 'license_key' => array('name' => 'license_key', 'type' => 'xsd:string'), 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), 'mobile' => array('name' => 'mobile', 'type' => 'xsd:string'), 'fax' => array('name' => 'fax', 'type' => 'xsd:string'), 'email' => array('name' => 'email', 'type' => 'xsd:string'), 'secondaryemail' => array('name' => 'secondaryemail', 'type' => 'xsd:string'), 'website' => array('name' => 'website', 'type' => 'xsd:string'), 'lead_status' => array('name' => 'lead_status', 'type' => 'xsd:string'), 'rating' => array('name' => 'rating', 'type' => 'xsd:string'), 'employees' => array('name' => 'employees', 'type' => 'xsd:string'), 'address_street' => array('name' => 'address_street', 'type' => 'xsd:string'), 'address_city' => array('name' => 'address_city', 'type' => 'xsd:string'), 'address_state' => array('name' => 'address_state', 'type' => 'xsd:string'), 'address_postalcode' => array('name' => 'address_postalcode', 'type' => 'xsd:string'), 'address_country' => array('name' => 'address_country', 'type' => 'xsd:string'), 'description' => array('name' => 'description', 'type' => 'xsd:string'), 'deleted' => array('name' => 'deleted', 'type' => 'xsd:string'), 'converted' => array('name' => 'converted', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('user_column_detail', 'complexType', 'array', '', array('firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), 'username' => array('name' => 'username', 'type' => 'xsd:string'), 'secondaryemail' => array('name' => 'secondaryemail', 'type' => 'xsd:string'), 'title' => array('name' => 'title', 'type' => 'xsd:string'), 'workphone' => array('name' => 'workphone', 'type' => 'xsd:string'), 'department' => array('name' => 'department', 'type' => 'xsd:string'), 'mobilephone' => array('name' => 'mobilephone', 'type' => 'xsd:string'), 'otherphone' => array('name' => 'otherphone', 'type' => 'xsd:string'), 'fax' => array('name' => 'fax', 'type' => 'xsd:string'), 'email' => array('name' => 'email', 'type' => 'xsd:string'), 'homephone' => array('name' => 'homephone', 'type' => 'xsd:string'), 'otheremail' => array('name' => 'otheremail', 'type' => 'xsd:string'), 'street' => array('name' => 'street', 'type' => 'xsd:string'), 'city' => array('name' => 'city', 'type' => 'xsd:string'), 'state' => array('name' => 'state', 'type' => 'xsd:string'), 'code' => array('name' => 'code', 'type' => 'xsd:string'), 'country' => array('name' => 'country', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('tickets_list_array', 'complexType', 'array', '', array('ticketid' => array('name' => 'ticketid', 'type' => 'xsd:string'), 'title' => array('name' => 'title', 'type' => 'xsd:string'), 'groupname' => array('name' => 'groupname', 'type' => 'xsd:string'), 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), 'parent_id' => array('name' => 'parent_id', 'type' => 'xsd:string'), 'productid' => array('name' => 'productid', 'type' => 'xsd:string'), 'productname' => array('name' => 'productname', 'type' => 'xsd:string'), 'priority' => array('name' => 'priority', 'type' => 'xsd:string'), 'severity' => array('name' => 'severity', 'type' => 'xsd:string'), 'status' => array('name' => 'status', 'type' => 'xsd:string'), 'category' => array('name' => 'category', 'type' => 'xsd:string'), 'description' => array('name' => 'description', 'type' => 'xsd:string'), 'solution' => array('name' => 'solution', 'type' => 'xsd:string'), 'createdtime' => array('name' => 'createdtime', 'type' => 'xsd:string'), 'modifiedtime' => array('name' => 'modifiedtime', 'type' => 'xsd:string'))); $server->register('get_contacts_columns', array('user_name' => 'xsd:string', 'session' => 'xsd:string'), array('return' => 'tns:contact_column_detail'), $NAMESPACE); $server->register('get_accounts_columns', array('user_name' => 'xsd:string', 'session' => 'xsd:string'), array('return' => 'tns:account_column_detail'), $NAMESPACE); $server->register('get_leads_columns', array('user_name' => 'xsd:string', 'session' => 'xsd:string'), array('return' => 'tns:lead_column_detail'), $NAMESPACE); $server->register('get_user_columns', array('user_name' => 'xsd:string', 'session' => 'xsd:string'), array('return' => 'tns:user_column_detail'), $NAMESPACE); $server->register('get_tickets_columns', array('user_name' => 'xsd:string', 'session' => 'xsd:string'), array('return' => 'tns:tickets_list_array'), $NAMESPACE); $server->register('create_session', array('user_name' => 'xsd:string', 'password' => 'xsd:string', 'version' => 'xsd:string'), array('return' => 'xsd:string', 'session' => 'xsd:string'), $NAMESPACE); $server->register('end_session', array('user_name' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); function get_tickets_columns($user_name, $session)
function __construct() { // force to set global variable $debug // before calling parent constructor $GLOBALS['debug'] = $this->mDebugMode; parent::soap_server($this->mWsdlFile); // to support SoapGatewayBase // -------------------------- if (!$this->mWsdlFile && !empty($this->mRegisteredFunctions)) { foreach ($this->mRegisteredFunctions as $func_name => $params) { if (is_array($params) && $params != NULL) { $this->register($func_name, $params['in'], $params['out'], $params['namespace'], $params['soapaction'], $params['style'], $params['use'], $params['documentation'], $params['encodingStyle']); } else { $this->register($func_name); } } } /////////// if (!$this->mWsdlFile && empty($this->mRegisteredFunctions)) { // doing magic here... avrakedavra! // $mServiceDescriptions is a static property, so it won't be inherited // as the result, we must do some tricks here. first we find what class is // being instantiated (from the dispatcher, of course. mmm.. no, no, use // get_class instead. it's definitly more efficient). then we use that // information to obtain the actual $mServiceDescriptions // see note about $mServiceDescriptions above for another information $class_name = get_class($this); eval('$service_description = ' . $class_name . '::$mServiceDescriptions;'); if (!empty($service_description)) { // get default binding style eval('$default_style = ' . $class_name . '::$mServiceBindingStyle;'); // setting up wsdl $this->configureWSDL($class_name, FALSE, Configuration::Instance()->GetValue('application', 'baseaddress') . Dispatcher::Instance()->GetUrl(Dispatcher::Instance()->mModule, Dispatcher::Instance()->mSubModule, Dispatcher::Instance()->mAction, Dispatcher::Instance()->mType, TRUE), $default_style); // register functions to be exposed as service if (isset($service_description['service']) && is_array($service_description['service'])) { foreach ($service_description['service'] as $func_name => $params) { // skip undeclared fuctions if (!method_exists($this, 'Service' . $func_name)) { continue; } if (is_array($params) && $params != NULL) { $this->register($func_name, $params['in'], $params['out'], $params['namespace'], $params['soapaction'], $params['style'], $params['use'], $params['documentation'], $params['encodingStyle']); } else { $this->register($func_name); } } } // register types used in services if (isset($service_description['type']) && is_array($service_description['type'])) { foreach ($service_description['type'] as $type_name => $params) { if (is_array($params) && $params != NULL) { if ($params['typeClass'] == 'complexType' || $params['typeClass'] == 'attribute') { $this->wsdl->addComplexType($type_name, $params['typeClass'], $params['phpType'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arrayType']); } else { if ($params['typeClass'] == 'simpleType') { // always scalar $this->wsdl->addSimpleType($type_name, $params['restrictionBase'], $params['typeClass'], 'scalar', $params['enumeration']); } } } } } } } }
<?php require_once 'nusoap.php'; $URL = "http://localhost/prak_sit_travel/service/service_testimonial.php"; $namespace = $URL . '?wsdl'; $server = new soap_server(); $server->configureWSDL('travel', $namespace); $server->register('testimonial', array('input' => 'xsd:String'), array('output' => 'xsd:Array'), 'urn:servicetestimonial', 'urn:servicetestimonial#testimonial', 'rpc', 'encoded', 'menampilkan testimonial wisata'); $server->register('tambah_testimonial', array('input' => 'xsd:Array'), array('output' => 'xsd:Array'), 'urn:servicetestimonial', 'urn:servicetestimonial#tambah_testimonial', 'rpc', 'encoded', 'menambah Testimonial Pelanggan'); // koneksi ke database include "koneksi.php"; function testimonial() { $query = "SELECT * from testimonial"; $hasil = mysql_query($query); while ($data = mysql_fetch_array($hasil)) { // menyimpan data hasil pencarian dalam array $result[] = array('id_testimonial' => $data['id_testimonial'], 'nama' => $data['nama'], 'email' => $data['email'], 'isi' => $data['isi'], 'tanggal' => $data['tanggal']); } // mereturn array hasil pencarian return $result; } function tambah_testimonial($nama, $email, $isi) { $date = date("Y-m-d H:i:s"); $query = "INSERT INTO testimonial (nama, email, isi, tanggal) VALUES ('{$nama}', '{$email}', '{$isi}','{$date}')"; $hasil = mysql_query($query); if ($hasil) { return true; } else { return false;
<?php /* For licensing terms, see /license.txt */ /** * This script provides the caller service with user details. * It is set to work with the Chamilo module for Drupal: * http://drupal.org/project/chamilo * * @author Yannick Warnier <*****@*****.**> * @package chamilo.webservices */ require_once '../inc/global.inc.php'; $libpath = api_get_path(LIBRARY_PATH); // Create the server instance $server = new soap_server(); // Initialize WSDL support $server->configureWSDL('WSUserInfo', 'urn:WSUserInfo'); /* Register WSCourseList function */ // Register the data structures used by the service $server->wsdl->addComplexType('courseDetails', 'complexType', 'struct', 'all', '', array('name' => 'code', 'type' => 'xsd:string', 'name' => 'title', 'type' => 'xsd:string', 'name' => 'url', 'type' => 'xsd:string', 'name' => 'teacher', 'type' => 'xsd:string', 'name' => 'language', 'type' => 'xsd:string')); $server->wsdl->addComplexType('courseList', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP:ENC:arrayType', 'wsdl:arrayType' => 'tns:courseDetails[]')), 'tns:courseDetails'); // Register the method to expose $server->register('WSCourseListOfUser', array('username' => 'xsd:string', 'signature' => 'xsd:string'), array('return' => 'xsd:Array'), 'urn:WSUserInfo', 'urn:WSUserInfo#WSUserInfo', 'rpc', 'encoded', 'This service returns a list of courses'); /** * Get a list of courses (code, url, title, teacher, language) for a specific * user and return to caller * Function registered as service. Returns strings in UTF-8. * @param string User name in Chamilo * @param string Signature (composed of the sha1(username+apikey) * @return array Courses list (code=>[title=>'title',url='http://...',teacher=>'...',language=>''],code=>[...],...) */
/* For licensing terms, see /license.txt */ /** * This script provides the caller service with a list * of courses that have a certain level of visibility * on this chamilo portal. * It is set to work with the Chamilo module for Drupal: * http://drupal.org/project/chamilo * * @author Yannick Warnier <*****@*****.**> * @package chamilo.webservices */ require_once '../inc/global.inc.php'; $libpath = api_get_path(LIBRARY_PATH); // Create the server instance $server = new soap_server(); // Initialize WSDL support $server->configureWSDL('WSCourseList', 'urn:WSCourseList'); /* Register WSCourseList function */ // Register the data structures used by the service $server->wsdl->addComplexType('courseDetails', 'complexType', 'struct', 'all', '', array('name' => 'code', 'type' => 'xsd:string', 'name' => 'title', 'type' => 'xsd:string', 'name' => 'url', 'type' => 'xsd:string', 'name' => 'teacher', 'type' => 'xsd:string', 'name' => 'language', 'type' => 'xsd:string')); $server->wsdl->addComplexType('courseList', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP:ENC:arrayType', 'wsdl:arrayType' => 'tns:courseDetails[]')), 'tns:courseDetails'); // Register the method to expose $server->register('WSCourseList', array('username' => 'xsd:string', 'signature' => 'xsd:string', 'visibilities' => 'xsd:string'), array('return' => 'xsd:Array'), 'urn:WSCourseList', 'urn:WSCourseList#WSCourseList', 'rpc', 'encoded', 'This service returns a list of courses'); /** * Get a list of courses (code, url, title, teacher, language) and return to caller * Function registered as service. Returns strings in UTF-8. * @param string User name in Chamilo * @param string Signature (composed of the sha1(username+apikey) * @param mixed Array or string. Type of visibility of course (public, public-registered, private, closed) * @return array Courses list (code=>[title=>'title',url='http://...',teacher=>'...',language=>''],code=>[...],...)
<?php //incluindo do arquivo nusoap require_once 'ws\\nusoap.php'; $server = new soap_server(); $server->register('hello'); function hello($name) { return 'HELLO' . $name; } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
{ if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } //return $ip; if ($ip != "" and $ip != "::1" and $ip != "127.0.0.1" and $ip != "localhost") { echo "You are not authorized."; exit; } } get_ip(); $server = new soap_server(); $server->configureWSDL("FruityWifi", "urn:FruityWifi"); $server->register("serviceAction", array("service" => "xsd:string", "action" => "xsd:string"), array("return" => "xsd:string"), "urn:FruityWifi", "urn:FruityWifi#serviceAction", "rpc", "encoded", "Modules action"); $server->register("moduleAction", array("module" => "xsd:string", "action" => "xsd:string"), array("return" => "xsd:string"), "urn:FruityWifi", "urn:FruityWifi#moduleAction", "rpc", "encoded", "Modules action"); $server->register("getAllInterfaces", array("module" => "xsd:string", "action" => "xsd:string"), array("return" => "xsd:string"), "urn:FruityWifi", "urn:FruityWifi#getAllInterfaces", "rpc", "encoded", "Modules action"); $server->register("getInterface", array("module" => "xsd:string"), array("return" => "xsd:string"), "urn:FruityWifi", "urn:FruityWifi#getInterface", "rpc", "encoded", "Modules action"); $server->register("setInterface", array("config" => "xsd:string", "interface" => "xsd:string"), array("return" => "xsd:string"), "urn:FruityWifi", "urn:FruityWifi#setInterface", "rpc", "encoded", "Modules action"); $server->register("getModules", array("module" => "xsd:string", "action" => "xsd:string"), array("return" => "xsd:string"), "urn:FruityWifi", "urn:FruityWifi#getModules", "rpc", "encoded", "Modules action"); $server->register("getStatus", array("service" => "xsd:string"), array("return" => "xsd:string"), "urn:FruityWifi", "urn:FruityWifi#getStatus", "rpc", "encoded", "Service status"); $server->register("getModuleStatus", array("module" => "xsd:string", "action" => "xsd:string"), array("return" => "xsd:string"), "urn:FruityWifi", "urn:FruityWifi#getModuleStatus", "rpc", "encoded", "Modules action"); $server->register("getServiceStatus", array("module" => "xsd:string", "action" => "xsd:string"), array("return" => "xsd:string"), "urn:FruityWifi", "urn:FruityWifi#getServiceStatus", "rpc", "encoded", "Modules action"); $server->service($HTTP_RAW_POST_DATA); function serviceAction($service, $action) { global $global_webserver; if ($service == "s_wireless") {
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 : ''); }
<?php /******************************************************************************* *******************************************************************************/ if (!defined('CONFIG')) { require_once "../svcutil.php"; } else { require_once DIR_SERVICE . 'svcutil.php'; $DONOTWEBSERVICE = true; } define("DATASET_SERVICE", "DataSet"); define("AUTH_SERVICE", "Authorization"); $namespace = HTTP_SERVICE . DATASET_SERVICE . '/' . DATASET_SERVICE . 'Service.php?wsdl'; $server = new soap_server(); $server->debug_flag = false; $server->configureWSDL(DATASET_SERVICE . 'Service', $namespace); $server->wsdl->schemaTargetNamespace = $namespace; require_once DIR_SERVICE . 'Common.SOAP.php'; require_once DATASET_SERVICE . "Service.definitions.php"; require_once DATASET_SERVICE . "Service.function.php"; require_once DATASET_SERVICE . "Service.registration.php"; require_once DIR_SERVICE . 'Common.definitions.php'; require_once DIR_SERVICE . AUTH_SERVICE . '/' . AUTH_SERVICE . "Service.definitions.php"; require_once DIR_SERVICE . AUTH_SERVICE . '/' . AUTH_SERVICE . "Service.function.php"; if (!isset($DONOTWEBSERVICE)) { $HTTP_RAW_POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : ''; $server->service($HTTP_RAW_POST_DATA); exit; }
<?php require_once 'nusoap.php'; $URL = "http://localhost/prak_sit_travel/service/service_login.php"; $namespace = $URL . '?wsdl'; $server = new soap_server(); $server->configureWSDL('travel', $namespace); $server->register('login', array('input' => 'xsd:Array'), array('output' => 'xsd:Array'), 'urn:servicelogin', 'urn:login#login', 'rpc', 'encoded', 'login admin'); // koneksi ke database include "koneksi.php"; function login($username, $password) { $hash = md5($password); $query = "SELECT * FROM admin WHERE username = '******' AND password = '******'"; $hasil = mysql_query($query); $num_rows = mysql_num_rows($hasil); // mereturn array hasil pencarian return $num_rows; } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
* ("License"); You may not use this file except in compliance with the License * The Original Code is: vtiger CRM Open Source * The Initial Developer of the Original Code is vtiger. * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. * ********************************************************************************/ require_once "config.php"; require_once 'include/logging.php'; require_once 'include/nusoap/nusoap.php'; require_once 'include/database/PearDatabase.php'; require_once 'modules/Contacts/Contacts.php'; $log =& LoggerManager::getLogger('thunderbirdplugin'); $accessDenied = "You are not authorized for performing this action"; $NAMESPACE = 'http://www.vtiger.com/products/crm'; $server = new soap_server(); $server->configureWSDL('vtigersoap'); $server->register('create_session', array('user_name' => 'xsd:string', 'password' => 'xsd:string', 'version' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); $server->register('end_session', array('user_name' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); $server->register('SearchContactsByEmail', array('username' => 'xsd:string', 'password' => 'xsd:string', 'emailaddress' => 'xsd:string'), array('return' => 'tns:contactdetails'), $NAMESPACE); $server->register('GetContacts', array('username' => 'xsd:string', 'password' => 'xsd:string'), array('return' => 'tns:contactdetails'), $NAMESPACE); $server->register('CheckContactPerm', array('user_name' => 'xsd:string', 'password' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); $server->register('CheckContactViewPerm', array('user_name' => 'xsd:string', 'password' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); $server->register('CheckContactEmailPerm', array('user_name' => 'xsd:string', 'password' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); $server->register('CheckLeadViewPerm', array('user_name' => 'xsd:string', 'password' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); $server->register('AddContact', array('user_name' => 'xsd:string', 'first_name' => 'xsd:string', 'last_name' => 'xsd:string', 'email_address' => 'xsd:string', 'account_name' => 'xsd:string', 'salutation' => 'xsd:string', 'title' => 'xsd:string', 'phone_mobile' => 'xsd:string', 'reports_to' => 'xsd:string', 'primary_address_street' => 'xsd:string', 'primary_address_city' => 'xsd:string', 'primary_address_state' => 'xsd:string', 'primary_address_postalcode' => 'xsd:string', 'primary_address_country' => 'xsd:string', 'alt_address_city' => 'xsd:string', 'alt_address_street' => 'xsd:string', 'alt_address_state' => 'xsd:string', 'alt_address_postalcode' => 'xsd:string', 'alt_address_country' => 'xsd:string', 'office_phone' => 'xsd:string', 'home_phone' => 'xsd:string', 'fax' => 'xsd:string', 'department' => 'xsd:string', 'password' => 'xsd:string', 'description' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); $server->register('AddLead', array('user_name' => 'xsd:string', 'first_name' => 'xsd:string', 'last_name' => 'xsd:string', 'email_address' => 'xsd:string', 'account_name' => 'xsd:string', 'salutation' => 'xsd:string', 'title' => 'xsd:string', 'phone_mobile' => 'xsd:string', 'reports_to' => 'xsd:string', 'primary_address_street' => 'xsd:string', 'primary_address_city' => 'xsd:string', 'primary_address_state' => 'xsd:string', 'primary_address_postalcode' => 'xsd:string', 'primary_address_country' => 'xsd:string', 'alt_address_city' => 'xsd:string', 'alt_address_street' => 'xsd:string', 'alt_address_state' => 'xsd:string', 'alt_address_postalcode' => 'xsd:string', 'alt_address_country' => 'xsd:string', 'office_phone' => 'xsd:string', 'home_phone' => 'xsd:string', 'fax' => 'xsd:string', 'department' => 'xsd:string', 'password' => 'xsd:string', 'description' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); $server->register('track_email', array('user_name' => 'xsd:string', 'password' => 'xsd:string', 'contact_ids' => 'xsd:string', 'date_sent' => 'xsd:string', 'email_subject' => 'xsd:string', 'email_body' => 'xsd:string'), array('return' => 'xsd:string'), $NAMESPACE); $server->wsdl->addComplexType('contactdetail', 'complexType', 'struct', 'all', '', array('id' => array('name' => 'id', 'type' => 'xsd:string'), 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), 'emailaddress' => array('name' => 'emailaddress', 'type' => 'xsd:string'), 'accountname' => array('name' => 'accountname', 'type' => 'xsd:string'), 'middlename' => array('name' => 'middlename', 'type' => 'xsd:string'), 'birthdate' => array('name' => 'birthdate', 'type' => 'xsd:string'), 'jobtitle' => array('name' => 'jobtitle', 'type' => 'xsd:string'), 'department' => array('name' => 'department', 'type' => 'xsd:string'), 'title' => array('name' => 'title', 'type' => 'xsd:string'), 'officephone' => array('name' => 'officephone', 'type' => 'xsd:string'), 'homephone' => array('name' => 'homephone', 'type' => 'xsd:string'), 'otherphone' => array('name' => 'otherphone', 'type' => 'xsd:string'), 'fax' => array('name' => 'fax', 'type' => 'xsd:string'), 'mobile' => array('name' => 'mobile', 'type' => 'xsd:string'), 'asstname' => array('name' => 'asstname', 'type' => 'xsd:string'), 'asstphone' => array('name' => 'asstphone', 'type' => 'xsd:string'), 'reportsto' => array('name' => 'reportsto', 'type' => 'xsd:string'), 'mailingstreet' => array('name' => 'mailingstreet', 'type' => 'xsd:string'), 'mailingcity' => array('name' => 'mailingcity', 'type' => 'xsd:string'), 'mailingstate' => array('name' => 'mailingstate', 'type' => 'xsd:string'), 'mailingzip' => array('name' => 'mailingzip', 'type' => 'xsd:string'), 'mailingcountry' => array('name' => 'mailingcountry', 'type' => 'xsd:string'), 'otherstreet' => array('name' => 'otherstreet', 'type' => 'xsd:string'), 'othercity' => array('name' => 'othercity', 'type' => 'xsd:string'), 'otherstate' => array('name' => 'otherstate', 'type' => 'xsd:string'), 'otherzip' => array('name' => 'otherzip', 'type' => 'xsd:string'), 'othercountry' => array('name' => 'othercountry', 'type' => 'xsd:string'), 'description' => array('name' => 'description', 'type' => 'xsd:string'), 'category' => array('name' => 'category', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('contactdetails', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:contactdetail[]')), 'tns:contactdetail'); function SearchContactsByEmail($username, $password, $emailaddress)
<?php require_once 'lib/nusoap.php'; include 'funciones.php'; //instanacia al servidor $server = new soap_server(); $ns = "urn:paiswsl"; $server->configureWSDL("Consulta Pais", $ns); //$server->schemaTargetNamespace = $ns; //$server->soap_defencoding = 'UTF-8'; //$server->decode_utf8 = false; //$server->encode_utf8 = true; /* $server->register("Listar", array("nombre_pais" => "xsd:string"), array("return" => "xsd:string"), $ns); */ $server->register("ListarPaises", array("dato" => "xsd:string"), array("return" => "xsd:string"), "urn:listapaises"); $server->register("ListarClubes", array("dato" => "xsd:string"), array("return" => "xsd:string"), "urn:listaclubes"); $server->register("ImagenClub", array("dato" => "xsd:string"), array("return" => "xsd:string"), "urn:imagenclub"); $server->register("ImagenPais", array("dato" => "xsd:string"), array("return" => "xsd:string"), "urn:imagenpais"); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);