• Download Gist
Simple soap service with zend framework.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
<?php
require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();
 
class MyClass {
/**
* This method takes ...
*
* @param integer $inputParam
* @return string
*/
public function method1($inputParam) {
return rand(1,10);
}
}
 
if(isset($_GET['wsdl'])) {
$autodiscover = new Zend_Soap_AutoDiscover();
$autodiscover->setBindingStyle(
array('style' => 'document',
'transport' => 'http://schemas.xmlsoap.org/soap/http')
);
$autodiscover->setOperationBodyStyle(
array('use' => 'literal')
);
 
$autodiscover->setClass('MyClass');
$autodiscover->handle();
} else if (isset($_GET['client'])) {
$client = new Zend_Soap_Client("http://localhost/soap/?wsdl");
echo $client->method1(10);
} else {
$soap = new Zend_Soap_Server("http://localhost/soap/?wsdl");
$soap->setClass('MyClass');
$soap->handle();
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.