<?php require_once 'nusoap.php'; $debug = 1; $server = new nusoap_server(); require_once "CSignCsr_class.php"; $server->register('CSignCsr.getInterface'); $server->register('CSignCsr.processData'); $server->register('CSignCsr.getName'); //Вот кто поймет что здесь написанно ТОМУ ПРИЗ!!!!!!!!!!!! $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
// 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 $server->register('UploadFile', array('bytes' => 'tns:FileBytes', 'filename' => 'xsd:string'), array('return' => 'xsd:boolean'), $ns, $ns . '#UploadFile', 'rpc', 'encoded', 'Upload a File'); // Use the request to (try to) invoke the service $HTTP_RAW_POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : ''; $server->service($HTTP_RAW_POST_DATA); exit; /* * Declare the functions which are called when the above methods are used */ function GetComplexType1($id) {
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); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
<?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();
// Define other specific objects $server->wsdl->addComplexType('thirdparty', 'complexType', 'struct', 'all', '', $thirdparty_fields); // Define other specific objects $server->wsdl->addComplexType('filterthirdparty', 'complexType', 'struct', 'all', '', array('client' => array('name' => 'client', 'type' => 'xsd:string'), 'supplier' => array('name' => 'supplier', 'type' => 'xsd:string'), 'category' => array('name' => 'category', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('ThirdPartiesArray', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:thirdparty[]')), 'tns:thirdparty'); $server->wsdl->addComplexType('ThirdPartiesArray2', 'complexType', 'array', 'sequence', '', array('thirdparty' => array('name' => 'thirdparty', 'type' => 'tns:thirdparty', 'minOccurs' => '0', 'maxOccurs' => 'unbounded'))); // 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. // Register WSDL $server->register('getThirdParty', array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), array('result' => 'tns:result', 'thirdparty' => 'tns:thirdparty'), $ns, $ns . '#getThirdParty', $styledoc, $styleuse, 'WS to get a thirdparty from its id, ref or ref_ext'); // Register WSDL $server->register('createThirdParty', array('authentication' => 'tns:authentication', 'thirdparty' => 'tns:thirdparty'), array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string'), $ns, $ns . '#createThirdParty', $styledoc, $styleuse, 'WS to create a thirdparty'); // Register WSDL $server->register('updateThirdParty', array('authentication' => 'tns:authentication', 'thirdparty' => 'tns:thirdparty'), array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns . '#updateThirdParty', $styledoc, $styleuse, 'WS to update a thirdparty'); // Register WSDL $server->register('getListOfThirdParties', array('authentication' => 'tns:authentication', 'filterthirdparty' => 'tns:filterthirdparty'), array('result' => 'tns:result', 'thirdparties' => 'tns:ThirdPartiesArray2'), $ns, $ns . '#getListOfThirdParties', $styledoc, $styleuse, 'WS to get list of thirdparties id and ref'); // Full methods code function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') { global $db, $conf, $langs; dol_syslog("Function: getThirdParty login="******" id=" . $id . " ref=" . $ref . " ref_ext=" . $ref_ext); if ($authentication['entity']) { $conf->entity = $authentication['entity']; } // Init and check authentication
<?php require_once "CCertInfo_class.php"; require_once 'nusoap.php'; $debug = 1; $server = new nusoap_server(); $server->register('CCertInfo.getSubject'); $server->register('CCertInfo.getSubjAttrVal'); $server->register('CCertInfo.getText'); $server->register('CCertInfo.getInterface'); $server->register('CCertInfo.processData'); $server->register('CCertInfo.getName'); //Вот кто поймет что здесь написанно ТОМУ ПРИЗ!!!!!!!!!!!! $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
// 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. // Register WSDL $server->register( 'getSupplierInvoice', // Entry values array('authentication'=>'tns:authentication','id'=>'xsd:string','ref'=>'xsd:string','ref_ext'=>'xsd:string'), // Exit values array('result'=>'tns:result','invoice'=>'tns:invoice'), $ns, $ns.'#getSupplierInvoice', $styledoc, $styleuse, 'WS to get SupplierInvoice' ); $server->register( 'getSupplierInvoicesForThirdParty', // Entry values array('authentication'=>'tns:authentication','idthirdparty'=>'xsd:string'), // Exit values array('result'=>'tns:result','invoices'=>'tns:invoices'), $ns, $ns.'#getSupplierInvoicesForThirdParty', $styledoc, $styleuse,
if (!empty($postParams)) { foreach ($postParams as $key => $value) { $_POST[$key] = $value; } } $_GET['module'] = $controller['module']; $_GET['class'] = $controller['class']; $_GET['method'] = $controller['method']; list($module, $class, $method) = wbRequest::getController(); $callback = wbRequest::getVarClean('callback'); if (!wbModule::isAvailable($module, $class, $type)) { header("HTTP/1.1 400 Bad Request"); return; } try { $result = wbModule::call($module, $class, $method, array(), $type); } catch (Exception $e) { $result = array('items' => array(), 'total' => 0, 'success' => false, 'message' => $e->getMessage()); } $return = array(); $return['success'] = $result['success']; $return['message'] = $result['message']; $return['total'] = $result['total']; $return['data'] = $result['items']; $return = base64_encode(serialize($return)); return $return; } $ws_svr->register('ws_proccess', array('search' => 'xsd:string', 'getParams' => 'xsd:string', 'controller' => 'xsd:string', 'postParams' => 'xsd:string', 'jsonItems' => 'xsd:string', 'start' => 'xsd:integer', 'limit' => 'xsd:integer'), array('return' => 'xsd:string'), 'urn:' . WS_NAMA_WSDL, 'urn:' . WS_NAMA_WSDL . '#ws_proccess', 'rpc', 'encoded', 'Deskripsi fungsi ws_proccess'); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $ws_svr->service($HTTP_RAW_POST_DATA); exit;
<?php require_once "CGetCert_class.php"; require_once 'nusoap.php'; $debug = 1; $server = new nusoap_server(); $server->register('CGetCert.getInterface'); $server->register('CGetCert.processData'); $server->register('CGetCert.getName'); $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(); }
array( array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:invoice[]') ), 'tns:invoice' );*/ $server->wsdl->addComplexType('InvoicesArray2', 'complexType', 'array', 'sequence', '', array('invoice' => array('name' => 'invoice', 'type' => 'tns:invoice', 'minOccurs' => '0', 'maxOccurs' => 'unbounded'))); // 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. // Register WSDL $server->register('getInvoice', array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), array('result' => 'tns:result', 'invoice' => 'tns:invoice'), $ns, $ns . '#getInvoice', $styledoc, $styleuse, 'WS to get a particular invoice'); $server->register('getInvoicesForThirdParty', array('authentication' => 'tns:authentication', 'idthirdparty' => 'xsd:string'), array('result' => 'tns:result', 'invoices' => 'tns:InvoicesArray2'), $ns, $ns . '#getInvoicesForThirdParty', $styledoc, $styleuse, 'WS to get all invoices of a third party'); $server->register('createInvoice', array('authentication' => 'tns:authentication', 'invoice' => 'tns:invoice'), array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string'), $ns, $ns . '#createInvoice', $styledoc, $styleuse, 'WS to create an invoice'); /** * Get invoice from id, ref or ref_ext. * * @param array $authentication Array of authentication information * @param int $id Id * @param string $ref Ref * @param string $ref_ext Ref_ext * @return array Array result */ function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '') { global $db, $conf, $langs; dol_syslog("Function: getInvoice login="******" id=" . $id . " ref=" . $ref . " ref_ext=" . $ref_ext);
<?php #servidor web service require_once 'lib/nusoap.php'; require_once 'func_bd.php'; include_once 'class.forms.php'; include_once 'config.php'; $bd = new formas($dsnAdmin); #el recurso global de la base de datos $server = new nusoap_server(); $server->register('datos'); #registra la funcion "datos" de func_bd.php $server->register('sql'); #registra la funcion "sql" de func_bd.php $server->register('sql2mod'); $server->register('getTotalPorCliente'); $server->register('getTotal'); $server->register('getTotalPorSuc'); $server->register('getTotalCliSuc'); $server->register('getFolios'); $server->register('getPartidas'); $server->register('getConcepto'); //*/ $server->register('modifTotal'); //*/ $server->register('addPartidaFolio'); //*/ $server->register('sqlhash'); //*/ $server->register('sqlHashQry'); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
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; }
} else { $v_key_search = !$p_key_search || $p_key_search == '' ? '' : $p_key_search; $v_page = !$p_page || $p_page == '' ? 0 : $p_page; $v_page_size = !$p_page_size || $p_page_size == '' ? 10 : $p_page_size; $v_page = (int) $v_page; $v_page_size = (int) $v_page_size; $v_key_search = '%' . $v_key_search . '%'; $v_key_search = (string) $v_key_search; $sql = "SELECT * \nFROM info_penduduk_propinsi\nWHERE prop_nama like '%s' \nLIMIT %d, %d"; $sql = sprintf($sql, $v_key_search, $v_page, $v_page_size); $stmt = mysql_query($sql, $conn); $return_data_count = mysql_affected_rows($conn); $return_data = array(); if (is_resource($stmt)) { while ($row = mysql_fetch_array($stmt)) { $return_data[] = $row; } } $return['data_count'] = $return_data_count; $return['data'] = $return_data; } //encode data $return = base64_encode(serialize($return)); return $return; } //Register Function to Service $ws_svr->register('list_propinsi', array('p_key_search' => 'xsd:string', 'p_page' => 'xsd:integer', 'p_page_size' => 'xsd:integer'), array('return' => 'xsd:string'), 'urn:' . WS_NAMA_WSDL, 'urn:' . WS_NAMA_WSDL . '#list_propinsi', 'rpc', 'encoded', 'Deskripsi fungsi list_propinsi'); //Create The Service Response $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $ws_svr->service($HTTP_RAW_POST_DATA); exit;
/** * 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; }
$extrafield_array['options_' . $key] = array('name' => 'options_' . $key, 'type' => $type); } $contact_fields = array_merge($contact_fields, $extrafield_array); // Define other specific objects $server->wsdl->addComplexType('contact', 'complexType', 'struct', 'all', '', $contact_fields); $server->wsdl->addComplexType('ContactsArray2', 'complexType', 'array', 'sequence', '', array('contact' => array('name' => 'contact', 'type' => 'tns:contact', 'minOccurs' => '0', 'maxOccurs' => 'unbounded'))); // 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. // Register WSDL $server->register('getContact', array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref_ext' => 'xsd:string'), array('result' => 'tns:result', 'contact' => 'tns:contact'), $ns, $ns . '#getContact', $styledoc, $styleuse, 'WS to get a contact'); // Register WSDL $server->register('createContact', array('authentication' => 'tns:authentication', 'contact' => 'tns:contact'), array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns . '#createContact', $styledoc, $styleuse, 'WS to create a contact'); $server->register('getContactsForThirdParty', array('authentication' => 'tns:authentication', 'idthirdparty' => 'xsd:string'), array('result' => 'tns:result', 'contacts' => 'tns:ContactsArray2'), $ns, $ns . '#getContactsForThirdParty', $styledoc, $styleuse, 'WS to get all contacts of a third party'); // Register WSDL $server->register('updateContact', array('authentication' => 'tns:authentication', 'contact' => 'tns:contact'), array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns . '#updateContact', $styledoc, $styleuse, 'WS to update a contact'); /** * Get Contact * * @param array $authentication Array of authentication information * @param int $id Id of object * @param string $ref_ext Ref external of object * @return mixed */ function getContact($authentication, $id, $ref_ext) {
<?php require_once '../../lib/nusoap/lib/nusoap.php'; $server = new nusoap_server(); $server->register('get_MemberCurrentLoan'); function get_MemberCurrentLoan($member_id) { if ($member_id == '') { return new nusoap_fault('Client', '', 'harus suplai dengan valid string'); } else { require_once '../core/member_cloan.inc.php'; $mcl = new member_cloan($member_id); $result = $mcl->get_result(); return $result; } } $server->service($HTTP_RAW_POST_DATA); ?>
*/ $server->wsdl->addComplexType('image', 'complexType', 'struct', 'all', '', array('photo' => array('name' => 'photo', 'type' => 'xsd:string'), 'photo_vignette' => array('name' => 'photo_vignette', 'type' => 'xsd:string'), 'imgWidth' => array('name' => 'imgWidth', 'type' => 'xsd:string'), 'imgHeight' => array('name' => 'imgHeight', 'type' => 'xsd:string'))); /* * Retour */ $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'))); // 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. // Register WSDL $server->register('getCategory', array('authentication' => 'tns:authentication', 'id' => 'xsd:string'), array('result' => 'tns:result', 'categorie' => 'tns:categorie'), $ns, $ns . '#getCategory', $styledoc, $styleuse, 'WS to get category'); /** * Get category infos and children * * @param array $authentication Array of authentication information * @param int $id Id of object * @return mixed */ function getCategory($authentication, $id) { global $db, $conf, $langs; dol_syslog("Function: getCategory login="******" id=" . $id); if ($authentication['entity']) { $conf->entity = $authentication['entity']; } $objectresp = array();
<?php // Подключаем SOAP require_once 'nusoap/nusoap.php'; $server = new nusoap_server(); $server->register('updateBill'); $server->service(file_get_contents("php://input")); // Эта функция вызывается при уведомлениях от QIWI Кошелька function updateBill($login, $password, $txn, $status) { // Если уведомление не о успешной оплате, нам это не интересно if ($status != 60) { return new soapval('updateBillResult', 'xsd:integer', 0); } // Работаем в корневой директории chdir('../../'); // Подключаем симплу require_once 'api/Okay.php'; $okay = new Okay(); // Выбираем оплачиваемый заказ $order = $okay->orders->get_order(intval($txn)); // 210 = Счет не найден if (empty($order)) { return new soapval('updateBillResult', 'xsd:integer', 210); } // Выбираем из базы соответствующий метод оплаты $method = $okay->payment->get_payment_method(intval($order->payment_method_id)); if (empty($method)) { return new soapval('updateBillResult', 'xsd:integer', 210); } // Настройки способа оплаты
<?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));
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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ if (!isset($ini)) { require_once 'Ini.php'; $ini = new Ini(); } $server = new nusoap_server(); $server->configureWSDL('ConcertoClientWSDL', 'urn:ConcertoClientWSDL'); $server->register('run_test', array('tid' => 'xsd:string', 'sid' => 'xsd:string', 'hash' => 'xsd:string', 'btn_name' => 'xsd:string', 'values' => 'xsd:string', 'debug' => 'xsd:string', 'pass' => 'xsd:string', 'time' => 'xsd:string', 'resume_from_last_template' => 'xsd:string'), array('result' => 'xsd:string'), 'urn:ConcertoClientWSDL', 'urn:ConcertoClientWSDL#run_test', 'rpc', 'encoded', 'start/resume Concerto test'); $server->register('get_last_html', array('sid' => 'xsd:string', 'hash' => 'xsd:string', 'pass' => 'xsd:string'), array('result' => 'xsd:string'), 'urn:ConcertoClientWSDL', 'urn:ConcertoClientWSDL#get_last_html', 'rpc', 'encoded', 'get Concerto test session last HTML'); $server->register('get_returns', array('sid' => 'xsd:string', 'hash' => 'xsd:string', 'pass' => 'xsd:string'), array('result' => 'xsd:string'), 'urn:ConcertoClientWSDL', 'urn:ConcertoClientWSDL#get_last_html', 'rpc', 'encoded', 'get Concerto test session return variables'); function authorize_WS($pass) { if (md5(Ini::$remote_client_password) == $pass) { return true; } else { return false; } } function run_test($tid, $sid, $hash, $btn_name, $values, $debug, $pass, $time, $resume_from_last_template) { if (!authorize_WS($pass)) { return false; }
<?php require_once "CReqGen_class.php"; require_once 'nusoap.php'; $debug = 1; $server = new nusoap_server(); $server->register('CReqGen.getInterface'); $server->register('CReqGen.processData'); $server->register('CReqGen.getName'); //Вот кто поймет что здесь написанно ТОМУ ПРИЗ!!!!!!!!!!!! $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?>
<?php require_once "CPath_class.php"; require_once 'nusoap.php'; $debug = 1; $server = new nusoap_server(); $server->register('CPath.getInterface'); $server->register('CPath.processData'); $server->register('CPath.getPath'); $server->register('CPath.getName'); //Вот кто поймет что здесь написанно ТОМУ ПРИЗ!!!!!!!!!!!! $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
<?php require_once '../../lib/nusoap/lib/nusoap.php'; $server = new nusoap_server(); $server->register('salam'); function salam($nama) { if ($nama == '') { return new nusoap_fault('Client', '', 'harus suplai dengan valid string'); } else { $result = 'Halo ' . $nama; return $result; } } $server->service($HTTP_RAW_POST_DATA); ?>
<?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 require_once "nusoap.php"; $server = new nusoap_server(); require_once "CConf_class.php"; $server->register('CConf.getName'); $server->register('CConf.getInterface'); $server->register('CConf.processData'); $server->register('CConf.getPolicySections'); //$server->register('CConf.getDefCaSectionName'); $server->register('CConf.getDefCaSecPolicyName'); $server->register('CConf.getInfoForGivenSectionName', array('sec_name' => 'xsd:string', 'conf_path' => 'xsd:string'), array(), 'uri:helloworld', 'uri:helloworld/hello', 'rpc', 'encoded'); $server->register('CConf.getSsCertInfo'); //$server->register('CConf.getSpkacSignInfo'); $server->register('CConf.getExtensionSections'); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
} $actioncomm_fields = array_merge($actioncomm_fields, $extrafield_array); // Define other specific objects $server->wsdl->addComplexType('actioncomm', 'complexType', 'struct', 'all', '', $actioncomm_fields); $server->wsdl->addComplexType('actioncommtype', 'complexType', 'array', 'sequence', '', array('code' => array('name' => 'code', 'type' => 'xsd:string'), 'libelle' => array('name' => 'libelle', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('actioncommtypes', 'complexType', 'array', 'sequence', '', array('actioncommtype' => array('name' => 'actioncommtype', 'type' => 'tns:actioncommtype', 'minOccurs' => '0', 'maxOccurs' => 'unbounded'))); // 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. // Register WSDL $server->register('getListActionCommType', array('authentication' => 'tns:authentication'), array('result' => 'tns:result', 'actioncommtypes' => 'tns:actioncommtypes'), $ns, $ns . '#getListActionCommType', $styledoc, $styleuse, 'WS to get actioncommType'); // Register WSDL $server->register('getActionComm', array('authentication' => 'tns:authentication', 'id' => 'xsd:string'), array('result' => 'tns:result', 'actioncomm' => 'tns:actioncomm'), $ns, $ns . '#getActionComm', $styledoc, $styleuse, 'WS to get actioncomm'); // Register WSDL $server->register('createActionComm', array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'), array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns . '#createActionComm', $styledoc, $styleuse, 'WS to create a actioncomm'); // Register WSDL $server->register('updateActionComm', array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'), array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns . '#updateActionComm', $styledoc, $styleuse, 'WS to update a actioncomm'); /** * Get ActionComm * * @param array $authentication Array of authentication information * @param int $id Id of object * @return mixed */ function getActionComm($authentication, $id) {
<?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); }
* An image */ $server->wsdl->addComplexType('image', 'complexType', 'struct', 'all', '', array('photo' => array('name' => 'photo', 'type' => 'xsd:string'), 'photo_vignette' => array('name' => 'photo_vignette', 'type' => 'xsd:string'), 'imgWidth' => array('name' => 'imgWidth', 'type' => 'xsd:string'), 'imgHeight' => array('name' => 'imgHeight', 'type' => 'xsd:string'))); // Define other specific objects $server->wsdl->addComplexType('filterproduct', 'complexType', 'struct', 'all', '', array('type' => array('name' => 'type', 'type' => 'xsd:string'), 'status_tobuy' => array('name' => 'status_tobuy', 'type' => 'xsd:string'), 'status_tosell' => array('name' => 'status_tosell', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('ProductsArray2', 'complexType', 'array', 'sequence', '', array('product' => array('name' => 'product', 'type' => 'tns:product', 'minOccurs' => '0', 'maxOccurs' => 'unbounded'))); // 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. // Register WSDL $server->register('getProductOrService', array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string', 'lang' => 'xsd:string'), array('result' => 'tns:result', 'product' => 'tns:product'), $ns, $ns . '#getProductOrService', $styledoc, $styleuse, 'WS to get product or service'); // Register WSDL $server->register('createProductOrService', array('authentication' => 'tns:authentication', 'product' => 'tns:product'), array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns . '#createProductOrService', $styledoc, $styleuse, 'WS to create a product or service'); // Register WSDL $server->register('updateProductOrService', array('authentication' => 'tns:authentication', 'product' => 'tns:product'), array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns . '#updateProductOrService', $styledoc, $styleuse, 'WS to update a product or service'); // Register WSDL $server->register('deleteProductOrService', array('authentication' => 'tns:authentication', 'listofid' => 'xsd:string'), array('result' => 'tns:result', 'nbdeleted' => 'xsd:int'), $ns, $ns . '#deleteProductOrService', $styledoc, $styleuse, 'WS to delete a product or service'); // Register WSDL $server->register('getListOfProductsOrServices', array('authentication' => 'tns:authentication', 'filterproduct' => 'tns:filterproduct'), array('result' => 'tns:result', 'products' => 'tns:ProductsArray2'), $ns, $ns . '#getListOfProductsOrServices', $styledoc, $styleuse, 'WS to get list of all products or services id and ref'); // Register WSDL $server->register('getProductsForCategory', array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'lang' => 'xsd:string'), array('result' => 'tns:result', 'products' => 'tns:ProductsArray2'), $ns, $ns . '#getProductsForCategory', $styledoc, $styleuse, 'WS to get list of all products or services for a category'); /** * Get produt or service * * @param array $authentication Array of authentication information * @param int $id Id of object
<?php //call library include 'MyLib.php'; require_once 'nusoap/lib/nusoap.php'; require_once 'adodb/adodb.inc.php'; $server = new nusoap_server(); $server->configureWSDL('server', 'urn:server'); $server->wsdl->schemaTargetNamespace = 'urn:server'; //register a function that works on server $server->register('login', array('username' => 'xsd:string', 'password' => 'xsd:string'), array('return' => 'xsd:boolean'), 'urn:server', 'urn:server#loginServer', 'rpc', 'encoded', 'login'); $server->register('insertAnggota', array('nama' => 'xsd:string', 'jk' => 'xsd:string', 'alamat' => 'xsd:string', 'notelp' => 'xsd:string', 'jenisId' => 'xsd:string', 'noId' => 'xsd:string'), array('return' => 'xsd: boolean'), 'urn:server', 'urn:server#insertAnggota', 'rpc', 'encoded', 'crud'); $server->register('insertKendaraan', array('idKen' => 'xsd:integer', 'jKen' => 'xsd:string', 'merek' => 'xsd:string', 'tipe' => 'xsd:string', 'warna' => 'xsd:string', 'noPol' => 'xsd:string', 'tahun' => 'xsd:integer', 'biaya' => 'xsd:integer', 'status' => 'xsd:string'), array('return' => 'xsd: boolean'), 'urn:server', 'urn:server#insertKendaraan', 'rpc', 'encoded', 'crud'); $server->register('getAnggota', array('cariBerdasarkan' => 'xsd:string', 'data' => 'xsd:string'), array('return' => 'xsd: string'), 'urn:server', 'urn:server#getAnggota', 'rpc', 'encoded', 'crud'); $server->register('getKendaraanByJenis', array('jKen' => 'xsd:string'), array('return' => 'xsd: boolean'), 'urn:server', 'urn:server#CRUDServer', 'rpc', 'encoded', 'crud'); //create function function login($username, $password) { $mylib = new MyLib(); return $result = $mylib->login($username, $password); } function insertAnggota($nama, $jk, $alamat, $noT, $jId, $noId) { $mylib = new MyLib(); $result = $mylib->insertAnggota($nama, $jk, $alamat, $noT, $jId, $noId); if ($result) { return true; } } function getAnggota($berdasarkan, $data) {