2010年11月3日星期三

Re: [fw-webservices] Soap Server does not uses getLastRequest

On 2 November 2010 21:01, pal4life <nadir.com@gmail.com> wrote:
>
> Hi,
> http://framework.zend.com/manual/1.11/en/zend.soap.server.html
>
> The above link shows an example of logging requests on the SOAP server using
> the getLastRequest. I am aware of using it with the client but is there a
> way to log those request with the server?
>
>  $this->getHelper('viewRenderer')->setNoRender(true);
>
>          // initialize server and set WSDL file location
>      $server = new Zend_Soap_Server('wsdl location');
>
>      // initialize server and set URI
>      //$server = new Zend_Soap_Server(null,
>  //       array('uri' => 'http://webservices.tjh2b.com/Labrequest/soap'));
>
>      // set SOAP service class
>      $server->setClass('Webservices_Manager');
>
>                $server->setRequest();
>
>
>      // register exceptions that generate SOAP faults
>      $server->registerFaultException(array('Webservices_Exception'));
>
>      // handle request
>      $server->handle();
>
>        echo $request = $server->getLastRequest();
>
> Thank you.
>
>
> --
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/Soap-Server-does-not-uses-getLastRequest-tp3024416p3024416.html
> Sent from the Zend Web Services mailing list archive at Nabble.com.
>

I would create a subclass to Zend_Soap_Server and override _setRequest ...

class myZSS extends Zend_Soap_Server {
/**
* Set and log the request.
*
* $request may be any of:
* - DOMDocument; if so, then cast to XML
* - DOMNode; if so, then grab owner document and cast to XML
* - SimpleXMLElement; if so, then cast to XML
* - stdClass; if so, calls __toString() and verifies XML
* - string; if so, verifies XML
*
* @param DOMDocument|DOMNode|SimpleXMLElement|stdClass|string $request
* @return Zend_Soap_Server
*/
protected function _setRequest($request) {
// Set the request.
parent::_setRequest($request);

// Log the request.
// $this->_getRequest() is the call to make to get the XML.

// Return the instance to allow for chaining.
return $this;
}
}

--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

没有评论: