Headers with multiple arguments

From: Date: Tue, 07 Oct 2003 19:59:38 +0000
Subject: Headers with multiple arguments
Groups: php.soap 
Request: Send a blank email to php-soap+get-1107@lists.php.net to get a copy of this message
Hi again, I've been experiencing an anomaly with PEAR::SOAP where SOAP header method calls are treated differently than the same-formatted method calls in the SOAP body. The Server.php header processing turns multiple arguments into a single Struct variable on the server side. For instance, this header: <SOAP-ENV:Header> <ns4:requestSessionID SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="1"> <clientKey xsi:type="xsd:string">christester</clientKey> <userAgent xsi:type="xsd:string">...user agent string...</userAgent> </ns4:requestSessionIDwithUserAgent> </SOAP-ENV:Header> My SOAP server header method is reading this as a single struct argument with "clientKey" and "userAgent" keys, rather than two separate arguments. Body methods separate the arguments the way I would expect. I changed this behaviour by changing "_decode" to "__decodeRequest" on line 333 of Server.php, analogous to the way the body method arguments are processed. Is this actually an appropriate fix? -Chris Diff (0.8RC2): *** original/Server.php Tue Oct 7 14:56:19 2003 --- Server.php Tue Oct 7 15:58:05 2003 *************** *** 330,341 ****
                 if ($isok) {
                     # call our header now!
                     $header_method = $header_val->name;
!                     $header_data = array($this->_decode($header_val));
                     // if there are parameters to pass
                     $hr =& $this->callMethod($header_method, $header_data);
                     # if they return a fault, then it's all over!
                     if (PEAR::isError($hr)) {
!                         $this->_raiseSoapFault($method_response);
                         return null;
                     }
                     $header_results[] = array_shift($this->buildResult($hr, $this->return_type, $header_method, $header_val->namespace));
--- 330,341 ----
                 if ($isok) {
                     # call our header now!
                     $header_method = $header_val->name;
!                     $header_data = array($this->__decodeRequest($header_val));
                     // if there are parameters to pass
                     $hr =& $this->callMethod($header_method, $header_data);
                     # if they return a fault, then it's all over!
                     if (PEAR::isError($hr)) {
!                         $this->_raiseSoapFault($hr);
                         return null;
                     }
                     $header_results[] = array_shift($this->buildResult($hr, $this->return_type, $header_method, $header_val->namespace));


« previous php.soap (#1107) next »