Location: PHPKode > scripts > sLog > sLog-0.8/pear_soap/slogclient.php
<?php
/** sLog v0.8
 *  copyright (c) 2008 Kjell-Inge Gustafsson kigkonsult
 *  www.kigkonsult.se/slog/index.php
 *  hide@address.com
 *
 *  Description:
 *  This file is a simple PHP SOAP sLog database client
 *
 *  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.
 *
 *  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., 59 Temple
 *  Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once '../include/form.php';
fixInput($_REQUEST, 'slogserver.wsdl' );
$formParams = array();
if( isset( $_REQUEST['submit'] ) && ( 0 < $_REQUEST['count'] )) {
            /* EXECUTE TEST */
  $time_start    = getmicrotime();
  require_once 'SOAP/Client.php';
  $skiptrace     = & PEAR::getStaticProperty('PEAR_Error', 'skiptrace');
  $skiptrace     = TRUE;
  $client        = new SOAP_Client( $_REQUEST['WSurl'], 'wsdl' );
  for($cnt = 0; $cnt < $_REQUEST['count']; $cnt++ ) {
    $params      = fixLogparams( $cnt, $_REQUEST );
    $params['subject'] .= ' soap';
    $result      = $client->call( 'setLog', $params );
     //  print_r($result);//The easyest way to see the result
    if( PEAR::isError( $result )) {  // SoapFault exception.. .
      $formParams['message'] = ( is_string( $result )) ? $message : 'SOAPFault: '.$result->getMessage();
      $_REQUEST['count'] = $cnt + 1;
      break;
    }
    elseif( '0' != $result ) { // any db error.. .
      $formParams['message'] = $result;
      $_REQUEST['count'] = $cnt + 1;
      break;
    }
  }
  $time_end = getmicrotime();
  $time     = $time_end - $time_start;
  $formParams['avgTime'] = ( empty( $formParams['message'] ) && 1 < $_REQUEST['count'] ) ? ' (avg='.number_format(( $time / $_REQUEST['count'] ), 4 ).')' : '';
  $formParams['time']    = number_format( $time, 4 );
}
$formParams['action'] = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
$formParams['title']  = 'sLog SOAP test';
$formParams['header'] = 'sLog SOAP access test';
$formParams['text']   = 'Test the capacity of sLog, fill in the number of test log events, update log item counts and START TEST.';
$formParams['URLlegend'] = 'server definition URL';
$formParams['URLlabel']  = 'wsdl URL';
form( $_REQUEST, $formParams );
?>
Return current item: sLog