Пример #1
0
 /**
  * Run the NuSOAP server
  * 
  * @param array $data The server data
  * @return boolean Response
  */
 public static function RunServer($data)
 {
     $server = $data['soapserver'];
     if ($server !== self::$Server || !class_exists('soap_server')) {
         PhpWsdl::Debug('NuSOAP not found or server object changed');
         return true;
         // We can't handle this server run!
     }
     $req = file_get_contents('php://input');
     $handled = false;
     if (!PhpWsdl::CallHook('NuSOAPRunHook', array_merge($data, array('req' => &$req, 'handled' => &$handled)))) {
         return $handled;
     }
     self::$Server->service(utf8_encode($req));
     return false;
 }
Пример #2
0
                            }
                            $iProduct++;
                        }
                    }
                    // Retour
                    $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'products' => $products);
                } else {
                    $errorcode = 'NORECORDS_FOR_ASSOCIATION';
                    $errorlabel = 'No products associated' . $sql;
                    $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
                    dol_syslog("getProductsForCategory:: " . $c->error, LOG_DEBUG);
                }
            } else {
                $error++;
                $errorcode = 'NOT_FOUND';
                $errorlabel = 'Object not found for id=' . $id;
            }
        } else {
            $error++;
            $errorcode = 'PERMISSION_DENIED';
            $errorlabel = 'User does not have permission for this request';
        }
    }
    if ($error) {
        $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
    }
    return $objectresp;
}
// Return the results.
$server->service(file_get_contents("php://input"));
Пример #3
0
{
    $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);
    curl_setopt($ch, CURLOPT_, 1);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
function query($query, $post)
{
    $args = array();
    foreach (json_decode($post) as $k => $v) {
        $args[$k] = $v;
    }
    $data = curl_post($query, $args);
    return $data;
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
Пример #4
0
    $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();
    $sql = "UPDATE medidas SET\n                peso = '" . $decodificado['peso'] . "',\n                altura = '" . $decodificado['altura'] . "',\n                peitoral_maior = '" . $decodificado['peitoral_maior'] . "',\n                peitoral_menor = '" . $decodificado['peitoral_menor'] . "',\n                quadril = '" . $decodificado['quadril'] . "',\n                biceps_esquerdo = '" . $decodificado['biceps_esquerdo'] . "',\n                biceps_direito = '" . $decodificado['biceps_direito'] . "',\n                triceps_esquerdo = '" . $decodificado['triceps_esquerdo'] . "',\n                triceps_direito = '" . $decodificado['triceps_direito'] . "',\n                coxas_esquerda = '" . $decodificado['coxas_esquerda'] . "',\n                coxas_direita = '" . $decodificado['coxas_direita'] . "',\n                panturrilha_esquerda = '" . $decodificado['panturrilha_esquerda'] . "',\n                panturrilha_direita = '" . $decodificado['panturrilha_direita'] . "',\n                quadril_esquerdo = '" . $decodificado['quadril_esquerdo'] . "',\n                quadril_direito = '" . $decodificado['quadril_direito'] . "'                     \n\t\t\t\tWHERE id = " . $id;
    $result = mysql_query($sql, $conecta);
    $retorno = "{\"id\":\"ok\"}";
    return $retorno;
}
// para sobecrever se a variavel estiver em branco.
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
// devolve para o clinte
$server->service($POST_DATA);
exit;
Пример #5
0
    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;
        //var_dump($newobject->date_lim_reglement); exit;
        //var_dump($invoice['lines'][0]['type']);
        $db->begin();
        $result = $newobject->create($fuser, 0, dol_stringtotime($invoice['date_due'], 'dayrfc'));
        if ($result < 0) {
            $error++;
        }
        if ($invoice['status'] == 1) {
            $result = $newobject->validate($fuser);
            if ($result < 0) {
                $error++;
            }
        }
        if (!$error) {
            $db->commit();
            $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref);
        } else {
            $db->rollback();
            $error++;
            $errorcode = 'KO';
            $errorlabel = $newobject->error;
        }
    }
    if ($error) {
        $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
    }
    return $objectresp;
}
// Return the results.
$server->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
Пример #7
0
 function service(&$data)
 {
     $this->raw_post_data = $data;
     parent::service($data);
 }
Пример #8
0
<?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);
Пример #9
0
 function result()
 {
     $this->layout = 'empty';
     App::import('Vendor', 'Nusoap', array('file' => 'nusoap' . DS . 'nusoap.php'));
     $server = new nusoap_server();
     $server->register('updateBill');
     $server->service($HTTP_RAW_POST_DATA);
     function updateBill($login, $password, $txn, $status)
     {
         $order = $this->Order->read(null, $txn);
         $qiwi_id_data = $this->PaymentMethod->PaymentMethodValue->find(array('key' => 'qiwi_id'));
         $qiwi_id = $qiwi_id_data['PaymentMethodValue']['value'];
         $qiwi_secret_key_data = $this->PaymentMethod->PaymentMethodValue->find(array('key' => 'qiwi_secret_key'));
         $qiwi_secret_key = $qiwi_secret_key_data['PaymentMethodValue']['value'];
         //обработка возможных ошибок авторизации
         if ($login != $qiwi_id) {
             return 150;
         }
         if (!empty($password) && $password != strtoupper(md5($txn . strtoupper(md5($qiwi_secret_key))))) {
             return 150;
         }
         // получаем номер заказа
         $transaction = intval($txn);
         // меняем статус заказа при условии оплаты счёта
         if ($status == 60) {
             $payment_method = $this->PaymentMethod->find(array('alias' => $this->module_name));
             $order_data = $this->Order->find('first', array('conditions' => array('Order.id' => $txn)));
             $order_data['Order']['order_status_id'] = $payment_method['PaymentMethod']['order_status_id'];
             $this->Order->save($order_data);
         }
     }
 }