📚 Looking for current Exponential documentation? This site contains legacy SDK & API reference docs (eZ Publish era). For up-to-date 2026 product documentation, visit doc.exponential.earth.

  ezsoap / calculator  

<< Hello World!  Class diagram >> 

Simple calculator

This simple calculator application sends two integer values to the server. The server adds these numbers and returns the result. This shows how you can add parameters to your request and how eZ soap™ handles the data types.

Sending request parameters

You can add request parameters with the addParameter function.

$request->addParameter( "valueA", 42 );
$request->addParameter( "valueB", 17 );

Server handling of parameters

On the server you have to register the function with the parameters and the types for the parameters. Since PHP is a loosely typed language we also have to set the type of the return value so that eZ soap™ knows what type to encode the response as.

include_once( "lib/ezsoap/classes/ezsoapserver.php" );

$server = new eZSOAPServer( );
$server->registerFunction( "addNumbers", array( "valueA" => "integer", "valueB" => "integer" ) );
$server->processRequest();

function addNumbers( $valueA, $valueB )
{
    $return = $valueA + $valueB;
    settype( $return, "integer" );
    return $return;
}

Exponential Copyright © 1998 - 2026 7x