On Sat, Dec 22, 2012 at 3:08 AM, Ralf Eggert <[email protected]> wrote:
> I am trying to setup a SOAP server with Zend\Soap\Server and want to
> test it with Zend\Soap\Client.
>
> Here is my server class:
>
> ----------------------------------------------------------------
> namespace Pizza\Soap;
>
> class Server
> {
> protected $pizzaList = array(
> '1' => 'Pizza Salami',
> '2' => 'Pizza Hawaii',
> '3' => 'Pizza Melone',
> );
>
> public function showPizzas()
Sorry for the late reply -- I've been on winter vacation.
The problem is right here. The way that Zend\Soap\Server (as well as
Json\Server and XmlRpc\Server) works is that it does reflection on the
docblock in order to determine the parameter types as well as the
return type. Since you have no docblock here, Zend\Soap\Autodiscover
cannot determine what the return type should be, and so assumes
"null"; Zend\Soap\Server, IIRC, should raise an error if the returned
value does not match the return type.
Now, I could be mistaken -- but try adding the docblock to see if it
corrects the issue, and then report back.
> {
> return $this->pizzaList;
> }
> }
> ----------------------------------------------------------------
>
> Here is the script that handles the server part:
>
> ----------------------------------------------------------------
> use Zend\Http\PhpEnvironment\Request;
> use Zend\Soap\AutoDiscover;
> use Zend\Soap\Server;
>
> $url = $this->serverUrl() . '/listing/listing1403';
> $request = new Request();
>
> if ($request->getQuery('wdsl') == 'show') {
> $autodiscover = new AutoDiscover();
> $autodiscover->setUri($url);
> $autodiscover->setClass('Pizza\Soap\Server');
> echo $autodiscover->toXml();
> } else {
> $server = new Server();
> $server->setUri($url);
> $server->setClass('Pizza\Soap\Server');
> echo $server->handle($request);
> }
> ----------------------------------------------------------------
> And here is the script that handles the client part:
>
> ----------------------------------------------------------------
> use Zend\Debug\Debug;
> use Zend\Soap\Client;
>
> $url = $this->serverUrl() . '/listing/listing1403?wdsl=show';
> $client = new Client($url);
> $result = $client->showPizzas();
>
> Debug::dump($result);
> Debug::dump($client->getFunctions());
> Debug::dump($client->getOptions());
> Debug::dump($client->getLastMethod());
> ----------------------------------------------------------------
>
> The first dump returns NULL while the other three calls return the
> expected data. So the server seems to be running. But something is wrong
> with the method calls.
>
> Has anyone any idea?
>
> Thanks and best regards,
>
> Ralf
>
> --
> List: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
>
>
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]