PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Performing SOAP Requests

After we've created a Zend_Soap_Client object we are ready to perform SOAP requests.

Each web service method is mapped to the virtual Zend_Soap_Client object method which takes parameters with common PHP types.

Use it like in the following example:

<?php
//****************************************************************
//                Server code
//****************************************************************
// class MyClass {
//     /**
//      * This method takes ...
//      *
//      * @param integer $inputParam
//      * @return string
//      */
//     public function method1($inputParam) {
//         ...
//     }
//
//     /**
//      * This method takes ...
//      *
//      * @param integer $inputParam1
//      * @param string  $inputParam2
//      * @return float
//      */
//     public function method2($inputParam1, $inputParam2) {
//         ...
//     }
//
//     ...
// }
// ...
// $server = new Zend_Soap_Server(null, $options);
// $server->setClass('MyClass');
// ...
// $server->handle();
//
//****************************************************************
//                End of server code
//****************************************************************

$client = new Zend_Soap_Client("MyService.wsdl");
...

// $result1 is a string
$result1 $client->method1(10);
...

// $result2 is a float
$result2 $client->method2(22'some string');

Zend Framework