function initSoapRequest($namespace, $nsurl) { global $nuserver, $HTTP_RAW_POST_DATA; if (!$HTTP_RAW_POST_DATA) { $HTTP_RAW_POST_DATA = file_get_contents('php://input'); } $nuserver = new nusoap_server(); $nuserver->configureWSDL($namespace, $nsurl); $nuserver->wsdl->schemaTargetNamespace = $nsurl; /* Define string und integer-arrays */ $nuserver->wsdl->addComplexType('ArrayOfstring', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:string[]')), 'xsd:string'); $nuserver->wsdl->addComplexType('ArrayOfint', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:int[]')), 'xsd:int'); }
<?php include "/var/www/html/nusoap/lib/nusoap.php"; include "Numeros.php"; $soap = new nusoap_server(); $soap->configureWSDL('numeros'); $soap->register('Numeros.add', array('a' => 'xsd:int', 'b' => 'xsd:int'), array('return' => 'xsd:int'), 'add'); $soap->register('Numeros.divide', array('a' => 'xsd:int', 'b' => 'xsd:int'), array('return' => 'xsd:int'), 'divide'); //var_dump($HTTP_RAW_POST_DATA); die(); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $soap->service($HTTP_RAW_POST_DATA);
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ if (!isset($ini)) { require_once '../model/Ini.php'; $ini = new Ini(); } require_once Ini::$internal_path . "lib/nusoap/nusoap.php"; $server = new nusoap_server(); $server->configureWSDL('ConcertoClientWSDL', 'urn:ConcertoClientWSDL'); $server->register('query', array('query' => 'xsd:string', 'post' => 'xsd:string'), array('result' => 'xsd:string'), 'urn:ConcertoClientWSDL', 'urn:ConcertoClientWSDL#query', 'rpc', 'encoded', 'Executes query.'); function curl_post($query, $post) { $post_fields = ""; foreach ($post as $k => $v) { if ($post_fields != "") { $post_fields .= "&"; } $post_fields .= $k . "=" . urlencode($v); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, Ini::$external_path . $query); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1);
/* * * Example NuSoap PHP WSDL * Copyright Sam Judson (c) 2004 * http://www.wackylabs.net * */ // Declare a namespace to be used below $ns = 'http://test.org/webservice'; // Include the nusoap file include "nusoap.php"; // Setup the WSDL $server = new nusoap_server(); $server->debug_flag = false; $server->configureWSDL('ExampleWsdl', $ns); $server->wsdl->schemaTargetNamespace = $ns; // Create a complex type $server->wsdl->addComplexType('ComplexType1', 'complexType', 'struct', 'all', '', array('Id' => array('name' => 'Id', 'type' => 'xsd:int'), 'Title' => array('name' => 'Title', 'type' => 'xsd:string'), 'Distance' => array('name' => 'Distance', 'type' => 'xsd:float'), 'Date' => array('name' => 'Date', 'type' => 'xsd:date'))); // Create an array of the above ComplexType1 // - Note that ComplexType1 is used with []'s and then without []'s $server->wsdl->addComplexType('Array1', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:ComplexType1[]')), 'tns:ComplexType1'); // Create a complex type to upload a file $server->wsdl->addComplexType('FileBytes', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:unsignedByte[]')), 'xsd:unsignedByte'); // Register the method to return a single ComplexType1 $server->register('GetComplexType1', array('Id' => 'xsd:int'), array('return' => 'tns:ComplexType1'), $ns, $ns . '#GetComplexType1', 'rpc', 'encoded', 'Get Specific ComplexType1'); // Register the method to return all ComplexType1s $server->register('GetAllComplexType1', array(), array('return' => 'tns:Array1'), $ns, $ns . '#GetAllComplexType1', 'rpc', 'encoded', 'Get All ComplexType1'); // Register the method to update a single CompexType1 $server->register('UpdateComplexType1', array('ComplexType1' => 'tns:ComplexType1'), array('return' => 'xsd:boolean'), $ns, $ns . '#UpdateComplexType1', 'rpc', 'encoded', 'Update a Complex Type'); // Register the method to uplaod a file
dol_syslog("Call Dolibarr webservices interfaces"); $langs->load("main"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { $langs->load("admin"); dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); print $langs->trans("WarningModuleNotActive", 'WebServices') . '.<br><br>'; print $langs->trans("ToActivateModule"); exit; } // Create the soap Object $server = new nusoap_server(); $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrThirdParty', $ns); $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL Authentication object $server->wsdl->addComplexType('authentication', 'complexType', 'struct', 'all', '', array('dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), 'login' => array('name' => 'login', 'type' => 'xsd:string'), 'password' => array('name' => 'password', 'type' => 'xsd:string'), 'entity' => array('name' => 'entity', 'type' => 'xsd:string'))); // Define WSDL Return object $server->wsdl->addComplexType('result', 'complexType', 'struct', 'all', '', array('result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'))); $thirdparty_fields = array('id' => array('name' => 'id', 'type' => 'xsd:string'), 'ref' => array('name' => 'name', 'type' => 'xsd:string'), 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), 'fk_user_author' => array('name' => 'fk_user_author', 'type' => 'xsd:string'), 'status' => array('name' => 'status', 'type' => 'xsd:string'), 'client' => array('name' => 'client', 'type' => 'xsd:string'), 'supplier' => array('name' => 'supplier', 'type' => 'xsd:string'), 'customer_code' => array('name' => 'customer_code', 'type' => 'xsd:string'), 'supplier_code' => array('name' => 'supplier_code', 'type' => 'xsd:string'), 'customer_code_accountancy' => array('name' => 'customer_code_accountancy', 'type' => 'xsd:string'), 'supplier_code_accountancy' => array('name' => 'supplier_code_accountancy', 'type' => 'xsd:string'), 'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'), 'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'), 'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'), 'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'), 'address' => array('name' => 'address', 'type' => 'xsd:string'), 'zip' => array('name' => 'zip', 'type' => 'xsd:string'), 'town' => array('name' => 'town', 'type' => 'xsd:string'), 'province_id' => array('name' => 'province_id', 'type' => 'xsd:string'), 'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'), 'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'), 'country' => array('name' => 'country', 'type' => 'xsd:string'), 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), 'fax' => array('name' => 'fax', 'type' => 'xsd:string'), 'email' => array('name' => 'email', 'type' => 'xsd:string'), 'url' => array('name' => 'url', 'type' => 'xsd:string'), 'profid1' => array('name' => 'profid1', 'type' => 'xsd:string'), 'profid2' => array('name' => 'profid2', 'type' => 'xsd:string'), 'profid3' => array('name' => 'profid3', 'type' => 'xsd:string'), 'profid4' => array('name' => 'profid4', 'type' => 'xsd:string'), 'profid5' => array('name' => 'profid5', 'type' => 'xsd:string'), 'profid6' => array('name' => 'profid6', 'type' => 'xsd:string'), 'capital' => array('name' => 'capital', 'type' => 'xsd:string'), 'vat_used' => array('name' => 'vat_used', 'type' => 'xsd:string'), 'vat_number' => array('name' => 'vat_number', 'type' => 'xsd:string')); //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label('societe', true); if (count($extrafields) > 0) { $extrafield_array = array(); } foreach ($extrafields->attribute_label as $key => $label) { //$value=$object->array_options["options_".$key];
<?php require_once 'lib/nusoap.php'; $server = new nusoap_server(); $server->configureWSDL('server.exemplo', 'http://retamero.com.br/webservice'); $server->wsdl->schemaTargetNamespace = 'http://retamero.com.br/webservice'; $server->register('exemplo', array('id' => 'xsd:string'), array('retorno' => 'xsd:string'), 'http://retamero.com.br/webservice', 'http://retamero.com.br/webservice/exemplo', 'rpc', 'encoded', 'Apenas um exemplo utilizando o NuSOAP PHP.'); $server->register('update', array('id' => 'xsd:string', 'json' => 'xsd:string'), array('retorno' => 'xsd:string'), 'http://retamero.com.br/webservice', 'http://retamero.com.br/webservice/update', 'rpc', 'encoded', 'Apenas um exemplo utilizando o NuSOAP PHP.'); function exemplo($id) { $conecta = mysql_connect("localhost", "user", "senha") or print mysql_error(); mysql_select_db("retamero_academia", $conecta) or print mysql_error(); $sql = "SELECT * FROM medidas WHERE aluno_id = " . $id; $result = mysql_query($sql, $conecta); //while($consulta = mysql_fetch_array($result)) { //pega indice valor e nome do campo e valor while ($consulta = mysql_fetch_assoc($result)) { // pega apenas nome do campo e valor $retorno = json_encode($consulta); } mysql_free_result($result); mysql_close($conecta); if ($retorno == "") { $retorno = "{\"id\":\"vazio\"}"; } return $retorno; } function update($id, $json) { $decodificado = json_decode($json, true); $conecta = mysql_connect("localhost", "user", "senha") or print mysql_error(); mysql_select_db("retamero_academia", $conecta) or print mysql_error();
/** * Create a NuSOAP soap_server object * * @param PhpWsdl $server The PhpWsdl object * @return nusoap_server The NuSOAP server object */ public static function CreateServer($server) { if (!is_null(self::$Server)) { return self::$Server; } // Basic configuration self::$Server = new nusoap_server(); self::$Server->debug_flag = false; self::$Server->soap_defencoding = 'UTF-8'; self::$Server->decode_utf8 = false; self::$Server->configureWSDL($server->Name, $server->NameSpace, $server->EndPoint); self::$Server->wsdl->schemaTargetNamespace = $server->NameSpace; if (!PhpWsdl::CallHook('NuSOAPConfigHook', array('server' => self::$Server))) { return self::$Server; } // Add types $i = -1; $len = sizeof($server->Types); while (++$i < $len) { $t = $server->Types[$i]; PhpWsdl::Debug('Add complex type ' . $t->Name); if (!PhpWsdl::CallHook('NuSOAPTypeHook', array_merge($data, array('type' => &$t)))) { continue; } if ($t->IsArray) { $type = $t->Type; self::$Server->wsdl->addComplexType($t->Name, 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => (in_array($type, PhpWsdl::$BasicTypes) ? 'xsd:' . $type : 'tns:' . $type) . '[]')), in_array($type, PhpWsdl::$BasicTypes) ? 'xsd:' . $type : 'tns:' . $type); } else { if (get_class($t) == 'PhpWsdlEnum') { self::$Server->wsdl->addSimpleType($t->Name, in_array($t->Type, PhpWsdl::$BasicTypes) ? 'xsd:' . $t->Type : 'tns:' . $t->Type, 'simpleType', 'scalar', $t->Elements); } else { $el = array(); $j = -1; $eLen = sizeof($t->Elements); while (++$j < $eLen) { $e = $t->Elements[$j]; $el[$e->Name] = array('name' => $e->Name, 'type' => in_array($e->Type, PhpWsdl::$BasicTypes) ? 'xsd:' . $e->Type : 'tns:' . $e->Type); } self::$Server->wsdl->addComplexType($t->Name, 'complexType', 'struct', 'sequence', '', $el); } } } PhpWsdl::CallHook('NuSOAPTypesHook', $data); // Add methods $i = -1; $len = sizeof($server->Methods); while (++$i < $len) { $m = $server->Methods[$i]; PhpWsdl::Debug('Register method ' . $m->Name); if (!PhpWsdl::CallHook('NuSOAPMethodHook', array_merge($data, array('method' => &$m)))) { continue; } $param = array(); $j = -1; $pLen = sizeof($m->Param); while (++$j < $pLen) { $p = $m->Param[$j]; $param[$p->Name] = in_array($p->Type, PhpWsdl::$BasicTypes) ? 'xsd:' . $p->Type : 'tns:' . $p->Type; } $r = $m->Return; self::$Server->register($m->IsGlobal ? $m->Name : $server->Name . '.' . $m->Name, $param, is_null($r) ? array() : array('return' => in_array($r->Type, PhpWsdl::$BasicTypes) ? 'xsd:' . $r->Type : 'tns:' . $r->Type), $server->NameSpace, $server->NameSpace . $m->Name, 'rpc', 'encoded'); } PhpWsdl::CallHook('NuSOAPMethodsHook', $data); return self::$Server; }
<?php // enable error reporting error_reporting(E_ALL); ini_set('display_error', 1); require_once "nusoap/lib/nusoap.php"; // initialize and configure server $server = new nusoap_server(); $server->configureWSDL('login', 'urn:login'); $server->wsdl->schemeTargeNamespace = "urn:login"; // register $server->register('loginService', array('nim' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:server', 'urn:server#loginServer', 'rpc', 'encoded', 'login ke aplikasi'); // create functions function dbConnect($query) { try { $connect = mysql_connect("localhost", "root", ""); $db = mysql_select_db("universitas"); return mysql_query($query); } catch (Exception $e) { echo $e->getMessage(); } } function loginService($nim) { // Check whether the user has filled all the required fields if (empty($nim)) { return 'Data tidak boleh kosong!'; } // sanitize the input from user $nim = strip_tags(mysql_real_escape_string($nim));
<?php require "../nusoap/lib/nusoap.php"; require 'Hp12c.php'; $server = new nusoap_server(); $server->configureWSDL('calculaMontante'); $server->register('Hp12c.calculaMontante', array('p' => 'xsd:decimal', 'i' => 'xsd:decimal', 'n' => 'xsd:integer', 'a' => 'xsd:integer'), array('return' => 'xsd:decimal'), 'calculaMontante'); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
dol_syslog("Call User webservices interfaces"); $langs->load("main"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { $langs->load("admin"); dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); print $langs->trans("WarningModuleNotActive", 'WebServices') . '.<br><br>'; print $langs->trans("ToActivateModule"); exit; } // Create the soap Object $server = new nusoap_server(); $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrUser', $ns); $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL Authentication object $server->wsdl->addComplexType('authentication', 'complexType', 'struct', 'all', '', array('dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), 'login' => array('name' => 'login', 'type' => 'xsd:string'), 'password' => array('name' => 'password', 'type' => 'xsd:string'), 'entity' => array('name' => 'entity', 'type' => 'xsd:string'))); // Define WSDL Return object $server->wsdl->addComplexType('result', 'complexType', 'struct', 'all', '', array('result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'))); // Define other specific objects $server->wsdl->addComplexType('user', 'complexType', 'struct', 'all', '', array('element' => array('name' => 'element', 'type' => 'xsd:string'), 'id' => array('name' => 'id', 'type' => 'xsd:string'), 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), 'note' => array('name' => 'note', 'type' => 'xsd:string'), 'email' => array('name' => 'email', 'type' => 'xsd:string'), 'signature' => array('name' => 'signature', 'type' => 'xsd:string'), 'office_phone' => array('name' => 'office_phone', 'type' => 'xsd:string'), 'office_fax' => array('name' => 'office_fax', 'type' => 'xsd:string'), 'user_mobile' => array('name' => 'user_mobile', 'type' => 'xsd:string'), 'admin' => array('name' => 'admin', 'type' => 'xsd:string'), 'login' => array('name' => 'login', 'type' => 'xsd:string'), 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), 'pass_indatabase' => array('name' => 'pass_indatabase', 'type' => 'xsd:string'), 'pass_indatabase_crypted' => array('name' => 'pass_indatabase_crypted', 'type' => 'xsd:string'), 'datec' => array('name' => 'datec', 'type' => 'xsd:dateTime'), 'datem' => array('name' => 'datem', 'type' => 'xsd:dateTime'), 'fk_thirdparty' => array('name' => 'fk_thirdparty', 'type' => 'xsd:string'), 'fk_contact' => array('name' => 'fk_contact', 'type' => 'xsd:string'), 'fk_member' => array('name' => 'fk_member', 'type' => 'xsd:string'), 'datelastlogin' => array('name' => 'datelastlogin', 'type' => 'xsd:dateTime'), 'datepreviouslogin' => array('name' => 'datepreviouslogin', 'type' => 'xsd:dateTime'), 'statut' => array('name' => 'statut', 'type' => 'xsd:string'), 'photo' => array('name' => 'photo', 'type' => 'xsd:string'), 'lang' => array('name' => 'lang', 'type' => 'xsd:string'), 'entrepots' => array('name' => 'entrepots', 'type' => 'xsd:string'), 'canvas' => array('name' => 'canvas', 'type' => 'xsd:string'))); // Define other specific objects $server->wsdl->addComplexType('group', 'complexType', 'struct', 'all', '', array('name' => array('name' => 'name', 'type' => 'xsd:string'), 'id' => array('name' => 'id', 'type' => 'xsd:string'), 'datec' => array('name' => 'datec', 'type' => 'xsd:string'), 'nb' => array('name' => 'nb', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('GroupsArray', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:group[]')), 'tns:group'); $thirdpartywithuser_fields = array('name' => array('name' => 'name', 'type' => 'xsd:string'), 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), 'name_thirdparty' => array('name' => 'name_thirdparty', 'type' => 'xsd:string'), 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), 'client' => array('name' => 'client', 'type' => 'xsd:string'), 'fournisseur' => array('name' => 'fournisseur', 'type' => 'xsd:string'), 'address' => array('name' => 'address', 'type' => 'xsd:string'), 'zip' => array('name' => 'zip', 'type' => 'xsd:string'), 'town' => array('name' => 'town', 'type' => 'xsd:string'), 'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'), 'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'), 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), 'phone_mobile' => array('name' => 'phone_mobile', 'type' => 'xsd:string'), 'fax' => array('name' => 'fax', 'type' => 'xsd:string'), 'email' => array('name' => 'email', 'type' => 'xsd:string'), 'url' => array('name' => 'url', 'type' => 'xsd:string'), 'profid1' => array('name' => 'profid1', 'type' => 'xsd:string'), 'profid2' => array('name' => 'profid2', 'type' => 'xsd:string'), 'profid3' => array('name' => 'profid3', 'type' => 'xsd:string'), 'profid4' => array('name' => 'profid4', 'type' => 'xsd:string'), 'profid5' => array('name' => 'profid5', 'type' => 'xsd:string'), 'profid6' => array('name' => 'profid6', 'type' => 'xsd:string'), 'capital' => array('name' => 'capital', 'type' => 'xsd:string'), 'tva_assuj' => array('name' => 'tva_assuj', 'type' => 'xsd:string'), 'tva_intra' => array('name' => 'tva_intra', 'type' => 'xsd:string'), 'login' => array('name' => 'login', 'type' => 'xsd:string'), 'password' => array('name' => 'password', 'type' => 'xsd:string'), 'group_id' => array('name' => 'group_id', 'type' => 'xsd:string')); //Retreive all extrafield for contact // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label('socpeople', true);
<?php ob_start(); include '../configuration.php'; include '../library/nusoap/nusoap.php'; // Create the server instance $server = new nusoap_server(); // Initialize WSDL support $server->configureWSDL('Get latest news ', 'http://tienkiem.net'); // don gian chi la chuc nag mo ta //add a custom data type $server->wsdl->addComplexType('Content', 'complexType', 'struct', 'all', '', array('id' => array('name' => 'id', 'type' => 'xsd:string'), 'alias' => array('name' => 'alias', 'type' => 'xsd:string'), 'title' => array('name' => 'title', 'type' => 'xsd:string'), 'created' => array('name' => 'created', 'type' => 'xsd:string'), 'ccalias' => array('name' => 'ccalias', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('ContentArray', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:Content[]')), 'tns:Content'); // GET LATEST NEWS $server->register('getLatestNews', array("catID" => "xsd:string", "limit" => "xsd:string", "ws_username" => "xsd:string", "ws_password" => "xsd:string"), array("result" => "tns:ContentArray"), 'uri:http://tienkiem.net', 'uri:http://127.0.0.1/tienkiem.net/api/api.php/getLatestNews', 'rpc', 'encode'); // FUNCTION CONFIG DB,HOST,USERNAME,PASSWORD... function jv_config($host, $username, $password, $db) { require_once "../configuration.php"; $jconfig = new JConfig(); return array("localhost" => $jconfig->host, "user" => $jconfig->user, "password" => $jconfig->password, "db" => $jconfig->db); } // Insert,Update ....into database .... by sms gateway function getLatestNews($catID, $limit, $ws_username, $ws_password) { try { if ($ws_username == 'xgo_api' && $ws_password == 'l4phskvtplklcfp172aavoegc3') { require_once "../configuration.php"; $jconfig = new JConfig(); $localhost = $jconfig->host; $user = $jconfig->user;
<?php error_reporting(E_ALL); ini_set('display_error', 1); require_once 'nusoap/lib/nusoap.php'; require_once 'adodb/adodb.inc.php'; require_once 'mahasiswa.php'; $server = new nusoap_server(); $server->configureWSDL('Service mahasiswa', 'urn:mahasiswa'); $server->wsdl->schemaTargetNamespace = 'urn:mahasiswa'; $server->register('get_mahasiswa', array(), array('return' => 'xsd:string'), 'urn:mahasiswa', 'urn:mahasiswa#get_mahasiswa', 'rpc', 'encoded', 'mengambil semua data mahasiswa'); $server->register('hapus_mahasiswa', array('nim' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:mahasiswa', 'urn:mahasiswa#hapus_mahasiswa', 'rpc', 'encoded', 'menghapus data mahasiswa'); $server->register('tambah_mahasiswa', array('nim' => 'xsd:string', 'nama' => 'xsd:string', 'alamat' => 'xsd:string', 'tempat_lahir' => 'xsd:string', 'tanggal_lahir' => 'xsd:string', 'fakultas' => 'xsd:string', 'jurusan' => 'xsd:string', 'agama' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:mahasiswa', 'urn:mahasiswa#tambah_mahasiswa', 'rpc', 'encoded', 'menambah data mahasiswa'); $server->register('ambilDataMhsByNIM', array('nim' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:mahasiswa', 'urn:mahasiswa#ambilDataMhsByNIM', 'rpc', 'encoded', 'mengambil data mahasiswa berdasarkan nim'); $server->register('ubahdataMahasiswa', array('nimAwal' => 'xsd:string', 'nim' => 'xsd:string', 'nama' => 'xsd:string', 'alamat' => 'xsd:string', 'tempat_lahir' => 'xsd:string', 'tanggal_lahir' => 'xsd:string', 'fakultas' => 'xsd:string', 'jurusan' => 'xsd:string', 'agama' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:mahasiswa', 'urn:mahasiswa#ubahdataMahasiswa', 'rpc', 'encoded', 'ubah data mahasiswa'); function get_mahasiswa() { $mahasiswa = new Mahasiswa(); return $mahasiswa->get_mahasiswa(); } function hapus_mahasiswa($nim) { $mahasiswa = new Mahasiswa(); return $mahasiswa->hapus_mahasiswa($nim); } function tambah_mahasiswa($nim, $nama, $alamat, $tempat_lahir, $tanggal_lahir, $fakultas, $jurusan, $agama) { $mahasiswa = new Mahasiswa(); return $mahasiswa->tambah_mahasiswa($nim, $nama, $alamat, $tempat_lahir, $tanggal_lahir, $fakultas, $jurusan, $agama); } function ambilDataMhsByNIM($nim)
<?php define('BLOCK_LOAD', true); require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/class-phpass.php'; $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); error_reporting(-1); require_once 'lib/nusoap.php'; $_HTTP = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://'; $ns = $_HTTP . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/" . basename($_SERVER['PHP_SELF']); $server = new nusoap_server(); // $server->soap_defencoding = 'UTF-8'; // $server->decode_utf8 = false; // $server->encode_utf8 = true; //echo 'test'; $server->configureWSDL('tpo10wsdl', 'urn:tpo10wsdl');
require_once DOL_DOCUMENT_ROOT . "/skeleton/class/skeleton.class.php"; dol_syslog("Call Skeleton webservices interfaces"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { $langs->load("admin"); dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); print $langs->trans("WarningModuleNotActive", 'WebServices') . '.<br><br>'; print $langs->trans("ToActivateModule"); exit; } // Create the soap Object $server = new nusoap_server(); $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrSkeleton', $ns); $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL Authentication object $server->wsdl->addComplexType('authentication', 'complexType', 'struct', 'all', '', array('dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), 'login' => array('name' => 'login', 'type' => 'xsd:string'), 'password' => array('name' => 'password', 'type' => 'xsd:string'), 'entity' => array('name' => 'entity', 'type' => 'xsd:string'))); // Define WSDL Return object $server->wsdl->addComplexType('result', 'complexType', 'struct', 'all', '', array('result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'))); // Define other specific objects $server->wsdl->addComplexType('skeleton', 'complexType', 'struct', 'all', '', array('prop1' => 'xxx', 'prop2' => 'xxx')); // 5 styles: RPC/encoded, RPC/literal, Document/encoded (not WS-I compliant), Document/literal, Document/literal wrapped // Style merely dictates how to translate a WSDL binding to a SOAP message. Nothing more. You can use either style with any programming model. // http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/ $styledoc = 'rpc'; // rpc/document (document is an extend into SOAP 1.0 to support unstructured messages) $styleuse = 'encoded'; // encoded/literal/literal wrapped // Better choice is document/literal wrapped but literal wrapped not supported by nusoap.
<?php error_reporting(E_ALL); ini_set('display_error', 1); require_once 'nusoap/lib/nusoap.php'; require_once 'adodb/adodb.inc.php'; require_once 'pegawai.php'; $server = new nusoap_server(); $server->configureWSDL('Service pegawai', 'urn:pegawai'); $server->wsdl->schemaTargetNamespace = 'urn:pegawai'; $server->register('get_pegawai', array('nip' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:pegawai', 'urn:pegawai#get_pegawai', 'rpc', 'encoded', 'Service untuk mengetahui daftar pegawai. Dan untuk menampilkan pegawai secara sepesifik'); $server->register('get_riwayat_pekerjaan', array('nip' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:pegawai', 'urn:pegawai#get_riwayat_pekerjaan', 'rpc', 'encoded', 'Service untuk mengetahui riwayat pekerjaan dari pegawai'); function get_pegawai($nip = "") { $pegawai = new Pegawai(); return $pegawai->get_pegawai($nip); } function get_riwayat_pekerjaan($nip = "") { $pegawai = new Pegawai(); return $pegawai->get_riwayat_pekerjaan($nip); } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; dol_syslog("Call Contact webservices interfaces"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { $langs->load("admin"); dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); print $langs->trans("WarningModuleNotActive", 'WebServices') . '.<br><br>'; print $langs->trans("ToActivateModule"); exit; } // Create the soap Object $server = new nusoap_server(); $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrContact', $ns); $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL Authentication object $server->wsdl->addComplexType('authentication', 'complexType', 'struct', 'all', '', array('dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), 'login' => array('name' => 'login', 'type' => 'xsd:string'), 'password' => array('name' => 'password', 'type' => 'xsd:string'), 'entity' => array('name' => 'entity', 'type' => 'xsd:string'))); // Define WSDL Return object $server->wsdl->addComplexType('result', 'complexType', 'struct', 'all', '', array('result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'))); $contact_fields = array('id' => array('name' => 'id', 'type' => 'xsd:string'), 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), 'address' => array('name' => 'address', 'type' => 'xsd:string'), 'zip' => array('name' => 'zip', 'type' => 'xsd:string'), 'town' => array('name' => 'town', 'type' => 'xsd:string'), 'state_id' => array('name' => 'state_id', 'type' => 'xsd:string'), 'state_code' => array('name' => 'state_code', 'type' => 'xsd:string'), 'state' => array('name' => 'state', 'type' => 'xsd:string'), 'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'), 'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'), 'country' => array('name' => 'country', 'type' => 'xsd:string'), 'socid' => array('name' => 'socid', 'type' => 'xsd:string'), 'status' => array('name' => 'status', 'type' => 'xsd:string'), 'phone_pro' => array('name' => 'phone_pro', 'type' => 'xsd:string'), 'fax' => array('name' => 'fax', 'type' => 'xsd:string'), 'phone_perso' => array('name' => 'phone_perso', 'type' => 'xsd:string'), 'phone_mobile' => array('name' => 'phone_mobile', 'type' => 'xsd:string'), 'code' => array('name' => 'code', 'type' => 'xsd:string'), 'email' => array('name' => 'email', 'type' => 'xsd:string'), 'birthday' => array('name' => 'birthday', 'type' => 'xsd:string'), 'default_lang' => array('name' => 'default_lang', 'type' => 'xsd:string'), 'note' => array('name' => 'note', 'type' => 'xsd:string'), 'no_email' => array('name' => 'no_email', 'type' => 'xsd:string'), 'ref_facturation' => array('name' => 'ref_facturation', 'type' => 'xsd:string'), 'ref_contrat' => array('name' => 'ref_contrat', 'type' => 'xsd:string'), 'ref_commande' => array('name' => 'ref_commande', 'type' => 'xsd:string'), 'ref_propal' => array('name' => 'ref_propal', 'type' => 'xsd:string'), 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), 'user_login' => array('name' => 'user_login', 'type' => 'xsd:string'), 'civility_id' => array('name' => 'civility_id', 'type' => 'xsd:string'), 'poste' => array('name' => 'poste', 'type' => 'xsd:string'), 'statut' => array('name' => 'statut', 'type' => 'xsd:string')); //Retreive all extrafield for contact // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label('socpeople', true); if (count($extrafields) > 0) { $extrafield_array = array(); } foreach ($extrafields->attribute_label as $key => $label) { $type = $extrafields->attribute_type[$key];
require_once DOL_DOCUMENT_ROOT . "/categories/class/categorie.class.php"; dol_syslog("Call Dolibarr webservices interfaces"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { $langs->load("admin"); dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); print $langs->trans("WarningModuleNotActive", 'WebServices') . '.<br><br>'; print $langs->trans("ToActivateModule"); exit; } // Create the soap Object $server = new nusoap_server(); $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrCategorie', $ns); $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL content $server->wsdl->addComplexType('authentication', 'complexType', 'struct', 'all', '', array('dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), 'login' => array('name' => 'login', 'type' => 'xsd:string'), 'password' => array('name' => 'password', 'type' => 'xsd:string'), 'entity' => array('name' => 'entity', 'type' => 'xsd:string'))); /* * Une catégorie */ $server->wsdl->addComplexType('categorie', 'complexType', 'struct', 'all', '', array('id' => array('name' => 'id', 'type' => 'xsd:string'), 'id_mere' => array('name' => 'id_mere', 'type' => 'xsd:string'), 'label' => array('name' => 'label', 'type' => 'xsd:string'), 'description' => array('name' => 'description', 'type' => 'xsd:string'), 'socid' => array('name' => 'socid', 'type' => 'xsd:string'), 'type' => array('name' => 'type', 'type' => 'xsd:string'), 'visible' => array('name' => 'visible', 'type' => 'xsd:string'), 'dir' => array('name' => 'dir', 'type' => 'xsd:string'), 'photos' => array('name' => 'photos', 'type' => 'tns:PhotosArray'), 'filles' => array('name' => 'filles', 'type' => 'tns:FillesArray'))); /* * Les catégories filles, sous tableau dez la catégorie */ $server->wsdl->addComplexType('FillesArray', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:categorie[]')), 'tns:categorie'); /* * Image of product */ $server->wsdl->addComplexType('PhotosArray', 'complexType', 'array', 'sequence', '', array('image' => array('name' => 'image', 'type' => 'tns:image', 'minOccurs' => '0', 'maxOccurs' => 'unbounded')));
<?php error_reporting(E_ALL); ini_set('display_error', 1); require_once 'nusoap/lib/nusoap.php'; require_once 'adodb/adodb.inc.php'; require_once 'books.php'; $server = new nusoap_server(); $server->configureWSDL('Service Books', 'urn:books'); $server->wsdl->schemaTargetNamespace = 'urn:books'; $server->register('books', array('input' => 'xsd:String'), array('output' => 'xsd:Array'), 'urn:books', 'urn:books#books', 'rpc', 'encoded', 'menampilkan data buku'); $server->register('get_book_by_id', array('id_book' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:books', 'urn:books#get_book_by_id', 'rpc', 'encoded', 'get_book_by_id'); $server->register('tambah_buku', array('input' => 'xsd:Array'), array('output' => 'xsd:Array'), 'urn:books', 'urn:books#tambah_buku', 'rpc', 'encoded', 'tambah_buku'); $server->register('edit_buku', array('input' => 'xsd:Array'), array('output' => 'xsd:Array'), 'urn:books', 'urn:books#edit_buku', 'rpc', 'encoded', 'edit buku'); $server->register('hapus_buku', array('input' => 'xsd:String'), array('output' => 'xsd:Array'), 'urn:books', 'urn:books#hapus_buku', 'rpc', 'encoded', 'menghapus data buku'); function books($id_book) { $query = "SELECT * FROM books where id_book = '{$id_book}'"; $hasil = mysql_query($query); while ($data = mysql_fetch_array($hasil)) { // menyimpan data hasil pencarian dalam array $result[] = array('id_book' => $data['id_book'], 'author' => $data['author'], 'title' => $data['title'], 'genre' => $data['genre'], 'price' => $data['price'], 'publish_date' => $data['publish_date'], 'description' => $data['description']); } // mereturn array hasil pencarian return $result; } function edit_buku($id_book, $author, $title, $genre, $price, $publish_date, $description) { $query = "UPDATE books SET author='{$author}', title = '{$title}', genre = '{$genre}', price = '{$price}', publish_date = '{$publish_date}', description = '{$description}' WHERE id_book = '{$id_book}'"; $hasil = mysql_query($query); if ($hasil) {
<?php error_reporting(E_ALL); ini_set('display_error', 1); require_once 'nusoap/lib/nusoap.php'; require_once 'adodb/adodb.inc.php'; require_once 'penduduk.php'; require_once 'kartuKeluarga.php'; $server = new nusoap_server(); $server->configureWSDL('Service Kependudukan', 'urn:kependudukan'); $server->wsdl->schemaTargetNamespace = 'urn:kependudukan'; $server->register('get_penduduk', array('nik' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#get_penduduk', 'rpc', 'encoded', 'mengambil semua data penduduk'); $server->register('get_penduduk_by_gender_male', array('nik' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#get_penduduk_by_gender_male', 'rpc', 'encoded', 'mengambil semua data penduduk berdasarkan gender laki-laki'); $server->register('get_penduduk_by_nik', array('nik' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#get_penduduk_by_nik', 'rpc', 'encoded', 'mengambil data penduduk berdasarkan nik'); $server->register('hapus_penduduk', array('nik' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#hapus_penduduk', 'rpc', 'encoded', 'menghapus data penduduk'); $server->register('tambah_penduduk', array('NIK' => 'xsd:string', 'nama' => 'xsd:string', 'jenis_kelamin' => 'xsd:string', 'nama' => 'xsd:string', 'tempat_lahir' => 'xsd:string', 'tanggal_lahir' => 'xsd:string', 'agama' => 'xsd:string', 'pendidikan' => 'xsd:string', 'no_kk' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#tambah_penduduk', 'rpc', 'encoded', 'menambah data penduduk'); $server->register('ubah_penduduk', array('NIKAWAL' => 'xsd:string', 'NIK' => 'xsd:string', 'nama' => 'xsd:string', 'jenis_kelamin' => 'xsd:string', 'nama' => 'xsd:string', 'tempat_lahir' => 'xsd:string', 'tanggal_lahir' => 'xsd:string', 'agama' => 'xsd:string', 'pendidikan' => 'xsd:string', 'no_kk' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#ubah_penduduk', 'rpc', 'encoded', 'merubah data penduduk'); $server->register('get_kartuKeluarga', array('nik' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#get_kartuKeluarga', 'rpc', 'encoded', 'mengambil semua data kartu keluarga'); $server->register('hapus_kartuKeluarga', array('no_kk' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#hapus_kartuKeluarga', 'rpc', 'encoded', 'menghapus data kartu keluarga'); $server->register('tambah_kartuKeluarga', array('no_kk' => 'xsd:string', 'kepala_keluarga' => 'xsd:string', 'alamat' => 'xsd:string', 'rt' => 'xsd:string', 'rw' => 'xsd:string', 'desa' => 'xsd:string', 'kecamatan' => 'xsd:string', 'kabupaten' => 'xsd:string', 'provinsi' => 'xsd:string', 'kode_pos' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#tambah_kartuKeluarga', 'rpc', 'encoded', 'menambah data kartu keluarga'); $server->register('ambilDataKKByNoKK', array('no_kk' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#ambilDataKKByNoKK', 'rpc', 'encoded', 'mengambil data kartu keluarga berdasarkan no kk'); $server->register('ambilAnggotaKeluarga', array('no_kk' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#ambilAnggotaKeluarga', 'rpc', 'encoded', 'mengambil data anggota keluarga berdasarkan no kk'); $server->register('ambilNonAnggotaKeluarga', array('no_kk' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#ambilNonAnggotaKeluarga', 'rpc', 'encoded', 'mengambil data yang bukan anggota keluarga'); $server->register('tambahAnggotaKartuKeluarga', array('no_kk' => 'xsd:string', 'NIK' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#tambahAnggotaKartuKeluarga', 'rpc', 'encoded', 'menambah data anggota keluarga'); $server->register('ubah_kartuKeluarga', array('no_kkAwal' => 'xsd:string', 'no_kk' => 'xsd:string', 'kepala_keluarga' => 'xsd:string', 'alamat' => 'xsd:string', 'rt' => 'xsd:string', 'rw' => 'xsd:string', 'desa' => 'xsd:string', 'kecamatan' => 'xsd:string', 'kabupaten' => 'xsd:string', 'provinsi' => 'xsd:string', 'kode_pos' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#ubah_kartuKeluarga', 'rpc', 'encoded', 'mengubah data kartu keluarga'); $server->register('hapusAnggotaKeluarga', array('no_kk' => 'xsd:string', 'nama' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:kependudukan', 'urn:kependudukan#hapusAnggotaKeluarga', 'rpc', 'encoded', 'menghapus anggota keluarga'); function hapusAnggotaKeluarga($no_kk, $nama) { $kartukeluarga = new kartukeluarga(); return $kartukeluarga->hapusAnggotaKeluarga($no_kk, $nama); }
<?php error_reporting(E_ALL); ini_set('display_error', 1); require_once 'nusoap/lib/nusoap.php'; require_once 'adodb/adodb.inc.php'; require_once 'cuaca_soap.php'; $server = new nusoap_server(); $server->configureWSDL('Service Cuaca', 'urn:cuaca'); $server->wsdl->schemaTargetNamespace = 'urn:cuaca'; $server->register('get_cuaca_by_id', array('id' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:cuaca ', 'urn:cuaca#get_cuaca_by_id', 'rpc', 'encoded', 'get_cuaca_by_id'); function get_cuaca_by_id($id = "") { $cuaca = new Cuaca(); return $cuaca->get_cuaca_by_id($id); } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
// Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { $langs->load("admin"); dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); print $langs->trans("WarningModuleNotActive",'WebServices').'.<br><br>'; print $langs->trans("ToActivateModule"); exit; } // Create the soap Object $server = new nusoap_server(); $server->soap_defencoding='UTF-8'; $server->decode_utf8=false; $ns='http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrSupplierInvoice',$ns); $server->wsdl->schemaTargetNamespace=$ns; // Define WSDL Authentication object $server->wsdl->addComplexType( 'authentication', 'complexType', 'struct', 'all', '', array( 'dolibarrkey' => array('name'=>'dolibarrkey','type'=>'xsd:string'), 'sourceapplication' => array('name'=>'sourceapplication','type'=>'xsd:string'), 'login' => array('name'=>'login','type'=>'xsd:string'), 'password' => array('name'=>'password','type'=>'xsd:string'),
<?php if (!defined('MUST_FROM_INDEX')) { exit('Cannot access file directly'); } //WS Configuration define('WS_NAMA_KELOMPOK', 'WS_KELOMPOK_X'); define('WS_NAMA_WSDL', 'WSDL_' . WS_NAMA_KELOMPOK . '.wsdl'); //Create WS Service Instance with WSDL $ws_svr = new nusoap_server(); $ws_svr->soap_defencoding = 'UTF-8'; $ws_svr->configureWSDL(WS_NAMA_KELOMPOK, 'urn:' . WS_NAMA_WSDL); //Function CheckAuth - User Authentication function CheckAuth($p_header) { global $ws_svr; $arr_h = $p_header; $user_name = $arr_h['AuthSoapHeader']['UserName']; $password = $arr_h['AuthSoapHeader']['Password']; $user_name = base64_decode($user_name); $password = base64_decode($password); $return = false; if ($user_name == 'wsclient' & $password == 'secret') { $return = true; } else { $ws_svr->fault('WSS-ERR-LOGIN-001', 'INVALID_USER_OR_PASSWORD', 'LOGIN', 'Kombinasi User dan Password Salah'); $return = false; } return $return; }
$global['apiVersion'] = $conf['mod_plus_latest_api']; } // fix broken apache servers that don't default to index.php $fix = ""; if(($_SERVER['HTTP_HOST'] == "archivestage.nlm.nih.gov") || ($_SERVER['HTTP_HOST'] == "archivestage")) { $fix = "index.php"; } // init vars $serviceName = "plusWebServices"; $ns = null; // "urn:".$serviceName; //disabled...do we really need it? $endpoint = makeBaseUrl().$fix."?wsdl".$versionString; $server = new nusoap_server; $server->configureWSDL($serviceName, $ns, $endpoint, 'document'); $server->wsdl->schemaTargetNamespace = $ns; shn_plus_registerAll($ns); // if in safe mode, raw post data not set: if(!isset($HTTP_RAW_POST_DATA)) { $HTTP_RAW_POST_DATA = implode("\r\n", file('php://input')); } $server->service($HTTP_RAW_POST_DATA);
<?php require_once 'nusoap/lib/nusoap.php'; //include('library.php'); include 'penduduk.php'; include 'calon.php'; $server = new nusoap_server(); $server->configureWSDL('server', 'urn:server'); $server->wsdl->schemaTargetNamespace = 'urn:server'; ini_set('display_errors', 'off'); //return type $server->wsdl->addComplexType('Calon', 'complexType', 'array', 'all', '', array('idcalon' => array('name' => 'idcalon', 'type' => 'xsd:int'), 'nocalon' => array('name' => 'nocalon', 'type' => 'xsd:int'), 'nama' => array('name' => 'nama', 'type' => 'xsd:string'), 'partai' => array('name' => 'partai', 'type' => 'xsd:string'), 'visimisi' => array('name' => 'visimisi', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('ArrayCalon', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:Calon[]'))); $server->wsdl->addComplexType('Penduduk', 'complexType', 'array', 'all', '', array('noktp' => array('name' => 'noktp', 'type' => 'xsd:int'), 'nama' => array('name' => 'nama', 'type' => 'xsd:string'), 'jeniskelamin' => array('name' => 'jeniskelamin', 'type' => 'xsd:string'), 'alamat' => array('name' => 'alamat', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('ArrayPenduduk', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:Penduduk[]'))); //register method $server->register('login', array('noktp' => 'xsd:int'), array('return' => 'xsd:string'), 'urn:server', 'urn:server#loginServer', 'rpc', 'encoded', 'login'); $server->register('getAllCalon', array(), array('return' => 'tns:ArrayCalon'), 'urn:server', 'urn:server#getAllCalon', 'rpc', 'encoded', 'get AllCalon'); $server->register('getDetailCalon', array('idcalon' => 'xsd:int'), array('return' => 'tns:Calon'), 'urn:server', 'urn:server#getDetailCalon', 'rpc', 'encoded', 'get Detail Calon'); $server->register('getAllPenduduk', array('noktp' => 'xsd:int'), array('return' => 'tns:ArrayPenduduk'), 'urn:server', 'urn:server#getAllPenduduk', 'rpc', 'encoded', 'get All Penduduk'); $server->register('getDetailPenduduk', array('noktp' => 'xsd:int'), array('return' => 'tns:Penduduk'), 'urn:server', 'urn:server#getDetailPenduduk', 'rpc', 'encoded', 'get Detail Penduduk'); $server->register('checkVote', array('noktp' => 'xsd:int'), array('return' => 'xsd:string'), 'urn:server', 'urn:server#checkVote', 'rpc', 'encoded', 'checkVote'); $server->register('voteCalon', array('noktp' => 'xsd:int', 'idcalon' => 'xsd:int'), array('return' => 'xsd:string'), 'urn:server', 'urn:server#voteCalon', 'rpc', 'encoded', 'voteCalon'); $server->register('insertPenduduk', array('noktp' => 'xsd:int', 'nama' => 'xsd:string', 'jeniskelamin' => 'xsd:string', 'alamat' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:server', 'urn:server#insertPenduduk', 'rpc', 'encoded', 'insert Penduduk'); $server->register('updatePenduduk', array('noktp' => 'xsd:int', 'nama' => 'xsd:string', 'jeniskelamin' => 'xsd:string', 'alamat' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:server', 'urn:server#updatePenduduk', 'rpc', 'encoded', 'update Penduduk'); $server->register('deletePenduduk', array('noktp' => 'xsd:int'), array('return' => 'xsd:string'), 'urn:server', 'urn:server#deletePenduduk', 'rpc', 'encoded', 'delete Penduduk'); function login($noktp) { $obj = new Penduduk(); $result = $obj->login($noktp); return $result;
<?php require_once 'lib/nusoap.php'; require_once "controller/ConfigManager.php"; $ConfigManager = new ConfigManager(); $elementNamespace = $ConfigManager->getElementNamespace(); $server = new nusoap_server(); // Create server instance $server->configureWSDL('gecredws', $elementNamespace); $server->register('login', array("username" => "xsd:string", "password" => "xsd:string"), array("result" => "xsd:string"), $elementNamespace); $server->register('version', array("param" => "xsd:string"), array("result" => "xsd:string"), $elementNamespace); function login($username, $password) { require_once "controller/LoginController.php"; $LoginController = new LoginController(); return $LoginController->login($username, $password); } function version() { require_once "controller/ConfigManager.php"; $ConfigManager = new ConfigManager(); return $ConfigManager->getVersione(); } // 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);
<?php error_reporting(E_ALL); ini_set('display_error', 1); require_once 'nusoap/lib/nusoap.php'; require_once 'adodb/adodb.inc.php'; require_once 'buku.php'; $server = new nusoap_server(); $server->configureWSDL('Service Buku', 'urn:buku'); $server->wsdl->schemaTargetNamespace = 'urn:buku'; $server->register('get_buku', array(), array('return' => 'xsd:string'), 'urn:buku', 'urn:buku#get_buku', 'rpc', 'encoded', 'mengambil semua data buku'); $server->register('get_buku_by_id', array('id' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:buku', 'urn:buku#get_buku_by_id', 'rpc', 'encoded', 'mengambil semua data buku berdasarkan id'); $server->register('hapus_buku', array('id' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:buku', 'urn:buku#hapus_buku', 'rpc', 'encoded', 'menghapus data buku'); $server->register('tambah_buku', array('no' => 'xsd:string', 'id' => 'xsd:string', 'nama' => 'xsd:string', 'pengarang' => 'xsd:string', 'penerbit' => 'xsd:string', 'tahun' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:buku', 'urn:buku#tambah_buku', 'rpc', 'encoded', 'menambah data buku'); $server->register('getDataByID', array('id' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:buku', 'urn:buku#getDataByID', 'rpc', 'encoded', 'ambil data by id'); $server->register('ubah_buku', array('idAWAL' => 'xsd:string', 'no' => 'xsd:string', 'id' => 'xsd:string', 'nama' => 'xsd:string', 'pengarang' => 'xsd:string', 'penerbit' => 'xsd:string', 'tahun' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:buku', 'urn:buku#ubah_buku', 'rpc', 'encoded', 'merubah data buku'); function getDataByID($id) { $buku = new Buku(); return $buku->getDataByID($id); } function get_buku_by_id($id) { $buku = new Buku(); return $buku->get_buku_by_id($id); } function get_buku() { $buku = new Buku(); return $buku->get_buku(); }
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; dol_syslog("Call ActionComm webservices interfaces"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { $langs->load("admin"); dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); print $langs->trans("WarningModuleNotActive", 'WebServices') . '.<br><br>'; print $langs->trans("ToActivateModule"); exit; } // Create the soap Object $server = new nusoap_server(); $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrActionComm', $ns); $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL Authentication object $server->wsdl->addComplexType('authentication', 'complexType', 'struct', 'all', '', array('dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), 'login' => array('name' => 'login', 'type' => 'xsd:string'), 'password' => array('name' => 'password', 'type' => 'xsd:string'), 'entity' => array('name' => 'entity', 'type' => 'xsd:string'))); // Define WSDL Return object $server->wsdl->addComplexType('result', 'complexType', 'struct', 'all', '', array('result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'))); $actioncomm_fields = array('id' => array('name' => 'id', 'type' => 'xsd:string'), 'ref' => array('name' => 'ref', 'type' => 'xsd:string'), 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), 'type_id' => array('name' => 'type_id', 'type' => 'xsd:string'), 'type_code' => array('name' => 'type_code', 'type' => 'xsd:string'), 'type' => array('name' => 'type', 'type' => 'xsd:string'), 'label' => array('name' => 'label', 'type' => 'xsd:string'), 'datep' => array('name' => 'datep', 'type' => 'xsd:dateTime'), 'datef' => array('name' => 'datef', 'type' => 'xsd:dateTime'), 'datec' => array('name' => 'datec', 'type' => 'xsd:dateTime'), 'datem' => array('name' => 'datem', 'type' => 'xsd:dateTime'), 'note' => array('name' => 'note', 'type' => 'xsd:string'), 'percentage' => array('name' => 'percentage', 'type' => 'xsd:string'), 'author' => array('name' => 'author', 'type' => 'xsd:string'), 'usermod' => array('name' => 'usermod', 'type' => 'xsd:string'), 'usertodo' => array('name' => 'usertodo', 'type' => 'xsd:string'), 'userdone' => array('name' => 'userdone', 'type' => 'xsd:string'), 'priority' => array('name' => 'priority', 'type' => 'xsd:string'), 'fulldayevent' => array('name' => 'fulldayevent', 'type' => 'xsd:string'), 'location' => array('name' => 'location', 'type' => 'xsd:string'), 'socid' => array('name' => 'socid', 'type' => 'xsd:string'), 'contactid' => array('name' => 'contactid', 'type' => 'xsd:string'), 'projectid' => array('name' => 'projectid', 'type' => 'xsd:string'), 'fk_element' => array('name' => 'fk_element', 'type' => 'xsd:string'), 'elementtype' => array('name' => 'elementtype', 'type' => 'xsd:string')); //Retreive all extrafield for actioncomm // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label('actioncomm', true); if (count($extrafields) > 0) { $extrafield_array = array(); } foreach ($extrafields->attribute_label as $key => $label) { $type = $extrafields->attribute_type[$key];
/* Load bootstrap so we can get started */ // nothing todo for now define('MUST_FROM_INDEX', 'SAMPLE_WS2011.2'); //load nusoap library require 'lib/webi/nusoap.php'; //run ws server if (!defined('MUST_FROM_INDEX')) { exit('Cannot access file directly'); } //WS Configuration define('WS_SIKP', 'BDS_SECURITY'); define('WS_NAMA_WSDL', 'WSDL_' . WS_SIKP . '.wsdl'); //Create WS Service Instance with WSDL $ws_svr = new nusoap_server(); $ws_svr->soap_defencoding = 'UTF-8'; $ws_svr->configureWSDL(WS_SIKP, 'urn:' . WS_NAMA_WSDL); function ws_proccess($search, $getParams, $controller, $postParams, $jsonItems, $start, $limit) { $GLOBALS["Webi_PageTime"] = microtime(true); include 'lib/bootstrap.php'; /* Load Webi Core */ sys::import('webi.core'); wbCore::init(); $_GET['jsonItems'] = $jsonItems; if (!empty($getParams)) { $getParams =& wbUtil::jsonDecode($getParams); } else { $getParams = array(); } if (json_decode($postParams) > 0) { $postParams = json_decode($postParams);
dol_syslog("Call Dolibarr webservices interfaces"); $langs->load("main"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { $langs->load("admin"); dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); print $langs->trans("WarningModuleNotActive", 'WebServices') . '.<br><br>'; print $langs->trans("ToActivateModule"); exit; } // Create the soap Object $server = new nusoap_server(); $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrProductOrService', $ns); $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL Authentication object $server->wsdl->addComplexType('authentication', 'complexType', 'struct', 'all', '', array('dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), 'login' => array('name' => 'login', 'type' => 'xsd:string'), 'password' => array('name' => 'password', 'type' => 'xsd:string'), 'entity' => array('name' => 'entity', 'type' => 'xsd:string'))); // Define WSDL Return object $server->wsdl->addComplexType('result', 'complexType', 'struct', 'all', '', array('result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'))); $productorservice_fields = array('id' => array('name' => 'id', 'type' => 'xsd:string'), 'ref' => array('name' => 'ref', 'type' => 'xsd:string'), 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), 'type' => array('name' => 'type', 'type' => 'xsd:string'), 'label' => array('name' => 'label', 'type' => 'xsd:string'), 'description' => array('name' => 'description', 'type' => 'xsd:string'), 'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'), 'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'), 'note' => array('name' => 'note', 'type' => 'xsd:string'), 'status_tobuy' => array('name' => 'status_tobuy', 'type' => 'xsd:string'), 'status_tosell' => array('name' => 'status_tosell', 'type' => 'xsd:string'), 'barcode' => array('name' => 'barcode', 'type' => 'xsd:string'), 'barcode_type' => array('name' => 'barcode_type', 'type' => 'xsd:string'), 'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'), 'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'), 'customcode' => array('name' => 'customcode', 'type' => 'xsd:string'), 'price_net' => array('name' => 'price_net', 'type' => 'xsd:string'), 'price' => array('name' => 'price', 'type' => 'xsd:string'), 'price_min_net' => array('name' => 'price_min_net', 'type' => 'xsd:string'), 'price_min' => array('name' => 'price_min', 'type' => 'xsd:string'), 'price_base_type' => array('name' => 'price_base_type', 'type' => 'xsd:string'), 'vat_rate' => array('name' => 'vat_rate', 'type' => 'xsd:string'), 'vat_npr' => array('name' => 'vat_npr', 'type' => 'xsd:string'), 'localtax1_tx' => array('name' => 'localtax1_tx', 'type' => 'xsd:string'), 'localtax2_tx' => array('name' => 'localtax2_tx', 'type' => 'xsd:string'), 'stock_alert' => array('name' => 'stock_alert', 'type' => 'xsd:string'), 'stock_real' => array('name' => 'stock_real', 'type' => 'xsd:string'), 'stock_pmp' => array('name' => 'stock_pmp', 'type' => 'xsd:string'), 'canvas' => array('name' => 'canvas', 'type' => 'xsd:string'), 'import_key' => array('name' => 'import_key', 'type' => 'xsd:string'), 'dir' => array('name' => 'dir', 'type' => 'xsd:string'), 'images' => array('name' => 'images', 'type' => 'tns:ImagesArray')); //Retreive all extrafield for product // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label('product', true); if (count($extrafields) > 0) { $extrafield_array = array(); } foreach ($extrafields->attribute_label as $key => $label) { $type = $extrafields->attribute_type[$key];
<?php header('Content-type: text/html; charset=utf-8'); ini_set("soap.wsdl_cache_enabled", "0"); require_once 'UserList.php'; require_once 'lib/nusoap.php'; $server = new nusoap_server(); $server->configureWSDL("userListesi", "urn:userListesi"); $server->register("UserListe", array("name" => "xsd:string"), array("return" => "xsd:Array"), "userListesi", "urn:userListesi", "rpc", "encoded"); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);