/**
 * This method returns average message length for all users who are all posted messages for given resource id.
 * @param rid - Resource ID
 * @return an array. Each item contains an other array where the key will be message_len and screen_name
 */
function voicetools_get_average_length_messages_per_user($rid)
{
    global $CFG;
    $soapclient = new soap_client($CFG->voicetools_servername . VT_API_SERVICES, true);
    $err = $soapclient->getError();
    if ($err) {
        wimba_add_log(WIMBA_ERROR, voiceboard_LOGS, __FUNCTION__ . ' : Error to create the soap element');
        return false;
    }
    $resource = array($CFG->voicetools_adminusername, $CFG->voicetools_adminpassword, $rid);
    $result = $soapclient->call(VT_API_GET_AVERAGE_MESSAGE_LENGTH_PER_USER, $resource);
    if ($soapclient->fault) {
        wimba_add_log(WIMBA_ERROR, voiceboard_LOGS, __FUNCTION__ . ' : Fault with the web service : ' . $soapclient->fault);
        return false;
    } else {
        // Check for errors
        $err = $soapclient->getError();
        if ($err == "operation getAverageMessageLengthPerUser not present.") {
            return "not_implemented";
        } else {
            if ($err) {
                wimba_add_log(WIMBA_ERROR, voiceboard_LOGS, __FUNCTION__ . ' : error with the web service : ' . $err);
                return false;
            }
        }
    }
    return pairsetToArray($result);
}
Ejemplo n.º 2
0
 /**
  * Funcion para envio de mensajes de texto
  * 
  * @param Numero telefonico para el envio del mensaje
  * @param Contenido del mensaje de texto
  */
 function envio_sms($telefono, $mensaje)
 {
     App::import('Vendor', 'nusoap/nusoap');
     $param = array('user' => 'tablerosetec', 'password' => 'tabset11', 'telefono' => $telefono, 'mensaje' => $mensaje);
     $endpoint = Configure::read('rutaWS');
     $client = new soap_client($endpoint);
     $err = $client->getError();
     if ($err) {
         echo "ERROR: " . $err;
         //este error se detona si hay algun problema con conectarse al Web Service
     }
     $result = $client->call('SendMessage', $param);
     //Retorna un Numero Entero
     if ($client->fault) {
         echo '<h2>Fault</h2><pre>';
         print_r($result);
         //En caso de falla
         echo '</pre>';
     } else {
         // Check for errors
         $err = $client->getError();
         //En caso de algun error, como parametros invalidos.
         if ($err) {
             // Display the error
             echo '<h2>Error</h2><pre>' . $err . '</pre>';
         } else {
             // Display the result
             //En caso de exito, para este WebService regresa un id unico
             // que es el id de la transaccion del mensaje, en la tabla outbox es un autoincremento
             //echo '<h2>Result</h2><pre>';
             //print_r($result);
             //echo '</pre>';
             return;
         }
     }
 }
Ejemplo n.º 3
0
<?php

exit;
//
// PART 3: Test it the normal way
//
include_once "./include/nusoap.php";
//include_once ("./include/class.ilXmlWriter.php");
$server = $_GET["server"] ? $_GET["server"] : "http://www.ilias.de/lt4el/Services/SOAPAuth/dummy_server.php";
$ext_uid = $_GET["ext_uid"] ? $_GET["ext_uid"] : "testuser";
$soap_pw = $_GET["soap_pw"] ? $_GET["soap_pw"] : "testpw";
$new_user = $_GET["new_user"];
echo '<form>' . 'server <input size="80" type="text" name="server" "value="' . $server . '"/>' . '<br />ext_uid <input size="50" type="text" name="ext_uid" "value="' . $ext_uid . '"/>' . '<br />soap_pw <input size="50" type="text" name="soap_pw" "value="' . $soap_pw . '"/>' . '<br />new_user <input size="50" type="text" name="new_user" "value="' . $new_user . '"/> (1 for true, 0 for false)' . '<br /><input type="submit" /><br />' . '<b>The test server will return true/valid, if ext_uid == soap_pw.</b>' . '</form>';
echo "<br /><br />----------------------------------------------<br /><br /> Calling Server...";
// initialize soap client
$client = new soap_client($server);
if ($err = $client->getError()) {
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
// isValidSession call
//$valid = $client->call('isValidSession',
//		array('ext_uid' => $ext_uid,
//			'soap_pw' => $soap_pw,
//			'new_user' => $new_user));
$namespace = "http://testuri.org";
$valid = $client->call('isValidSession', array('ns1:ext_uid' => $ext_uid, 'ns1:soap_pw' => $soap_pw, 'ns1:new_user' => $new_user), $namespace, $namespace . "/isValidSession");
showResult($client, $valid, 'isValidSession');
echo "<br />End Test";
function showResult(&$client, $data, $message)
{
    if ($client->fault) {
Ejemplo n.º 4
0
 /**
  * processes SOAP message returned from server
  *
  * @param	array	$headers	The HTTP headers
  * @param	string	$data		unprocessed response data from server
  * @return	mixed	value of the message, decoded into a PHP type
  * @access   private
  */
 function parseResponse($headers, $data)
 {
     $this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
     $this->responseAttachments = array();
     if (strstr($headers['content-type'], 'multipart/related')) {
         $this->debug('Decode multipart/related');
         $input = '';
         foreach ($headers as $k => $v) {
             $input .= "{$k}: {$v}\r\n";
         }
         $params['input'] = $input . "\r\n" . $data;
         $params['include_bodies'] = true;
         $params['decode_bodies'] = true;
         $params['decode_headers'] = true;
         $structure = Mail_mimeDecode::decode($params);
         foreach ($structure->parts as $part) {
             if (!isset($part->disposition)) {
                 $this->debug('Have root part of type ' . $part->headers['content-type']);
                 $return = parent::parseResponse($part->headers, $part->body);
             } else {
                 $this->debug('Have an attachment of type ' . $part->headers['content-type']);
                 $info['data'] = $part->body;
                 $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
                 $info['contenttype'] = $part->headers['content-type'];
                 $info['cid'] = $part->headers['content-id'];
                 $this->responseAttachments[] = $info;
             }
         }
         if (isset($return)) {
             return $return;
         }
         $this->setError('No root part found in multipart/related content');
         return;
     }
     $this->debug('Not multipart/related');
     return parent::parseResponse($headers, $data);
 }
Ejemplo n.º 5
0
# Lifter010: TODO
/*
 * client.php - PHP client implementation.
 *
 * Copyright (C) 2006 - Marcus Lunzenauer <*****@*****.**>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */
# set include path
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '../..');
require_once 'vendor/soap/nusoap.php';
define('WSDL_URL', "http://pomona/studip/mlunzena/trunk/webservices/soap.php?wsdl");
$client = new soap_client(WSDL_URL, TRUE);
$proxy = $client->getProxy();
# studip unstable is quite slow..
$proxy->response_timeout = 300;
echo "Creating Karl May.\n";
$user = $proxy->create_user('secret', array('user_name' => 'kmay', 'first_name' => 'Karl', 'last_name' => 'May', 'email' => '*****@*****.**', 'permission' => 'user'));
printf("  success: %s\n", var_export($user, TRUE));
echo "Retrieving Karl May.\n";
$user = $proxy->find_user_by_user_name('secret', 'kmay');
printf("  success: %s\n", var_export($user, TRUE));
echo "Updating Karl May.\n";
$user['email'] = "*****@*****.**";
$result = $proxy->update_user('secret', $user);
printf("  success: %s\n", var_export($result, TRUE));
echo "Retrieving Karl May.\n";
$user = $proxy->find_user_by_user_name('secret', 'kmay');