note 98021 added to class.soapserver
| From: | carlos dot vini at gmail dot com | Date: | Thu, 20 May 2010 20:55:15 +0000 |
| Subject: | note 98021 added to class.soapserver | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169476@lists.php.net to get a copy of this message | ||
SoapServer does not support WSDL with literal/document. I have a class:
<?php
class My_Soap {
/**
* Returns Hello World.
*
* @param string $world
* @return string
*/
public function getInterAdmins($world) {
return 'hello' . $world;
}
}
?>
To fix this I had to create proxy class:
<?php
class My_Soap_LiteralDocumentProxy {
public function __call($methodName, $args) {
$soapClass = new My_Soap();
$result = call_user_func(array($soapClass, $methodName), $args);
return array($methodName . 'Result' => $result);
}
}
?>
Now make sure that the WSDL is created using My_Soap. And that the Server is created using
My_Soap_LiteralDocumentProxy:
<?php
if (isset($_GET['wsdl'])) {
$wsdl = new Zend_Soap_AutoDiscover(); // It generates the WSDL
$wsdl->setOperationBodyStyle(array(
'use' => 'literal'
));
$wsdl->setBindingStyle(array(
'style' => 'document'
));
$wsdl->setClass('My_Soap');
$wsdl->handle();
} else {
$server = new Zend_Soap_Server('http://localhost/something/webservice.php?wsdl');
$server->setClass('My_Soap_LiteralDocumentProxy');
$server->handle();
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 201.6.156.39
----
Manual Page -- http://www.php.net/manual/en/class.soapserver.php
Edit -- https://master.php.net/note/edit/98021
Del: integrated -- https://master.php.net/note/delete/98021/integrated
Del: useless -- https://master.php.net/note/delete/98021/useless
Del: bad code -- https://master.php.net/note/delete/98021/bad+code
Del: spam -- https://master.php.net/note/delete/98021/spam
Del: non-english -- https://master.php.net/note/delete/98021/non-english
Del: in docs -- https://master.php.net/note/delete/98021/in+docs
Del: other reasons-- https://master.php.net/note/delete/98021
Reject -- https://master.php.net/note/reject/98021
Search -- https://master.php.net/manage/user-notes.php