Login   Register  
PHP Classes
elePHPant
Icontem

File: serverSide.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Marcus Brasizza  >  Simple Complex Type Builder  >  serverSide.php  >  Download  
File: serverSide.php
Role: Example script
Content type: text/plain
Description: Webservice Builder
Class: Simple Complex Type Builder
Helper to return complex types from SOAP servers
Author: By
Last change:
Date: 2012-03-19 13:49
Size: 1,321 bytes
 

Contents

Class file image Download
<?php

include('nuSoap/lib/nusoap.php');
include(
'ComplexHelper.class.php');
$server = new soap_server;
$nuHelper = new ComplexHelper($server);
// WSDL Support
$server->configureWSDL('My WSDL Services''urn:server.businessData');
$server->wsdl->schemaTargetNamespace 'urn:server.businessData';
mysql_connect('localhost''R0oT''N0n3P4s5');
mysql_select_db('epoc2h');
$nuHelper->SimpleComplexType('cliente')->bindArray('Arr');

// registra o método a ser oferecido
$server->register('last10'//method name
        
array(), //in
        
array('return' => 'tns:Arrcliente'), //out
        
'urn:server.businessData'//namespace
        
'urn:server.businessData#businessData'//soapaction
        
'rpc'//style
        
'encoded'//use
        
'get information of the latest 10 clients' //description
);

function 
last10() {
    
$qry "select * from cliente order by cod_cli DESC limit 10 ";
    
$rs mysql_query($qry);
    if (
mysql_numrows($rs) > 0) {
        
$dados = array();
        while (
$row mysql_fetch_array($rsMYSQL_ASSOC)) {
                
$dados[] = $row;            
        }
    }
    return 
$dados;
}

// requisição para uso do serviço
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA '';
$server->service($HTTP_RAW_POST_DATA);
?>