Issues

ZF-6964: Zend_Soap_AutoDiscover: Allow webservices to return void

Issue Type: Bug Created: 2009-06-09T06:35:46.000+0000 Last Updated: 2012-11-20T20:52:52.000+0000 Status: Closed Fix version(s): Reporter: Tim Riemenschneider (t.riemenschneider@detco.de) Assignee: None Tags: - Zend_Soap_Wsdl

Related issues: - ZF-6689

Attachments: - autodiscover-v2.diff

Description

When using AutoDiscover, it is currently not possible to have a method returning nothing (=void). When the portType is created, it references a message not included in the WSDL. f.e. the attached dummy-webservice creates a porttype:

<pre class="highlight">

from this code:

<pre class="highlight">
class TestService {
    /**
     * @param string $data
     * @return void
     */
    public function update($data)
    {
        // do something with $data
        // $operation_failed = true;
        if($operation_failed) {
            throw new SoapFault('Server', 'that did not work!');
        }
    }
}

without including tns:updateResponse

the fix is easy, AutoDiscover simply has to include an empty message, see patch

Comments

Posted by Tim Riemenschneider (t.riemenschneider@detco.de) on 2009-06-09T06:39:56.000+0000

Testservice and client to reproduce Patch to fix AutoDiscover.php

Posted by Benjamin Eberlei (beberlei) on 2009-06-12T10:49:14.000+0000

This should already be fixed in ZF-6689, which was released with 1.8.3

Posted by Tim Riemenschneider (t.riemenschneider@detco.de) on 2009-06-16T05:24:40.000+0000

really, was it? ;-)

However I tried svn trunk, which shows a different problem: Because return-void-functions are mapped to one-way-functions, the client does not wait for the soap-server (which is expected), which means it never gets the exception. (Unless called with feature SOAP_WAIT_ONE_WAY_CALLS of course) Ie. one-way-functions are functions that return no information to the caller, however in my use-case the function does return a bit of information: the presense or absense of an exception (SoapFault). (In the past I circumvented this with "@return boolean unused", but that is not clean code ;-) )

I have patched AutoDiscover.php further to check for a "@throws" in the functions/methods doc-block and only handle functions without this tag as one-way-functions. (I have however only tested this with php as client (and the eclipse-ws-explorer, which however waits for one-way-calls)) The patch simply sets isOneWayMessage back to false, the rest of the code does "the right thing" (IMHO) already, ie pass an empty array to addMessage.

Posted by Daniel Kreuer (dkreuer) on 2009-09-02T01:33:20.000+0000

This issue isn't fixed because of not generating one-way-operation "style" port bindings.

The port operation is created either one-way or two-way, but the binding is always created two-way. In ZF1.9.2/Zend/Soap/AutoDiscover.php:417 the binding operation mustn't have the output parameter for one-way operations.

Posted by Benjamin Eberlei (beberlei) on 2009-09-02T03:41:04.000+0000

re-opened because of said problems.

Posted by Rob Allen (rob) on 2012-11-20T20:52:52.000+0000

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts