Thursday, July 24, 2008
Home | Benchmarks | Documentation | Samples | FAQ | Links | Download
search php-soap for  


Samples

2. Multiple Types

 

Description:

 
  This example shows multiple parameters of different types. Additionally showing the server returning an object

 
 

Client:  multi-client.php

 
 

<?
$multi
= new SoapObject("http://www.yourserver.com/multi.php", "urn:Multi");
$tmp->foo = "bar";
$tmp->bar = "foo";
$obj = $multi->get_object("this is a string", 1, 1.2, array(1, 2, 3, 4), $tmp);

echo
$obj->string;
echo
$obj->long;
echo
$obj->double;
foreach(
$obj->array as $item)
    echo
$item;
echo
$obj->object->foo;
echo
$obj->object->bar;
?>
1


 
 

Server:  multi-server.php

 
 

<?
$server
= new SoapServer("urn:Multi");
$server->addFunction("get_object");
$server->handle();

function
get_object($string, $long, $double, $array, $obj)
{
    
$ret->string = $string;
    
$ret->long = $long;
    
$ret->double = $double;
    
$ret->array = $array;
    
$ret->obj = $obj;
    return
$ret;
}
?>
1


 
blue | green | yellow | grey
SourceForge Logo
Go to the main PHP site