Re: Headers with multiple arguments

From: Date: Tue, 07 Oct 2003 21:20:38 +0000
Subject: Re: Headers with multiple arguments
References: 1 2  Groups: php.soap 
Request: Send a blank email to php-soap+get-1109@lists.php.net to get a copy of this message
Got it! I didn't notice that the decodeRequest() call was within an array(). Silly me! -Chris Diff (from 0.8RC2): *** original/Server.php Tue Oct 7 14:56:19 2003 --- Server.php Tue Oct 7 17:19:23 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 = $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));
Christopher Lewis wrote:
Sorry, that didn't fix it at all, just changed the struct into an array! So, the question stands: is there a way to send multiple arguments to PEAR::SOAP header methods?
    -Chris
Christopher Lewis wrote:
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


« previous php.soap (#1109) next »