Edit report at http://bugs.php.net/bug.php?id=50762&edit=1

 ID:               50762
 Updated by:       dmi...@php.net
 Reported by:      mephius at gmail dot com
 Summary:          in WSDL mode Soap Header handler function only being
                   called if defined in WSDL
-Status:           Assigned
+Status:           Closed
 Type:             Bug
 Package:          SOAP related
 Operating System: Any
 PHP Version:      5.2.12
 Assigned To:      dmitry

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2010-05-28 12:52:19] dmi...@php.net

Automatic comment from SVN on behalf of dmitry
Revision: http://svn.php.net/viewvc/?view=revision&revision=299901
Log: Fixed bug #50762 (in WSDL mode Soap Header handler function only
being called if defined in WSDL). (mephius at gmail dot com)

------------------------------------------------------------------------
[2010-01-15 10:36:52] mephius at gmail dot com

May be linked to bug #49530

------------------------------------------------------------------------
[2010-01-15 10:33:22] mephius at gmail dot com

Description:
------------
While in WSDL mode, SoapServer looks for soap header handler function in
the WSDL only. Why one should expose his internal handling methods to
WSDL?

Suggested simple patch eliminates necessity to describe handle function
in WSDL. (but it just fixes symptoms, therefore should be revised)



--- soap.c      2009-11-21 21:43:00.000000000 +0200

+++ soap.c.patched      2010-01-15 12:06:55.000000000 +0200

@@ -1705,14 +1705,14 @@

                        soapHeader *h = header;



                        header = header->next;

-                       if (service->sdl && !h->function && !h->hdr) {

+/*                     if (service->sdl && !h->function && !h->hdr) {

                                if (h->mustUnderstand) {

                                       
soap_server_fault("MustUnderstand","Header not understood", NULL, NULL,
NULL TSRMLS_CC);

                                } else {

                                        continue;

                                }

                        }

-

+*/

                        fn_name =
estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name));

                        if (zend_hash_exists(function_table,
php_strtolower(fn_name, Z_STRLEN(h->function_name)),
Z_STRLEN(h->function_name) + 1) ||

                            ((service->type == SOAP_CLASS ||
service->type == SOAP_OBJECT) &&

Reproduce code:
---------------
WSDL: http://pastebin.com/f7cd32e16



You'll need to adjust soap endpoint to be able to run the code.



=== Server Code ===

<?php

class testSoap{

        private $auth;

        public function authToken($token){

                $this->auth=true;

        }

        public function testHeader($param){

                return 'header handler ' . ($this->auth ? 'called' : 'not 
called');

        }

}



$server = new SoapServer('bug.wsdl',
array('cache_wsdl'=>WSDL_CACHE_NONE));

$server->setObject(new testSoap());

$server->handle();

?>







=== Client Code ===



<?php



$cl = new SoapClient('/path/to/bug.wsdl',
array('cache_wsdl'=>WSDL_CACHE_NONE, 'trace'=>true));



class authToken{

        public function __construct($token){

                $this->authToken=$token;

        }

}



$cl->__setSoapHeaders(array(new SoapHeader('http://sova.pronto.ru/',
'authToken', new authToken('tokendata'))));

echo $cl->testHeader('param') . PHP_EOL;

?>

Expected result:
----------------
client code should echo "header handler called"

Actual result:
--------------
client code should echoes "header handler not called"


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=50762&edit=1

Reply via email to