Re: __doRequest()
| From: | Rob Richards | Date: | Mon, 19 Mar 2007 10:52:19 +0000 |
| Subject: | Re: __doRequest() | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-2481@lists.php.net to get a copy of this message | ||
miarde wrote:
1. Is __doRequest() implicitly called when a new SOAPClient is instantiated or does it need to be explicitly called? The reason I ask is because I need to extend SOAPClient to add certain parts of the request body using DOM. Without extending the class, I would do something like: $wsdl_url = "urlForWSDLHere"; $paramArray = array("param1","param2","param3"); $client = new SOAPClient(); $response = client->processRequest($paramArray); At what point in the code above is __doRequest() called in SOAPClient?It is automatically called during execution of your processRequest() method. It happens after the SOAP message has been assembled and just prior to sending it to the server. This allows you to make modifications before it's sent.
2. If I extend the class so that I can modify the request, I assume I'd override __doRequest() - the problem is that I can't find what the arguments could be. I know __doRequest takes $request, $location, $action, and $version but what exactly are these? I gather the following: $request = the actual XML request that I can modify. Is this sitting in a variable somewhere when I create a new SOAPClient? not really as there is no request until you call your method which in turn creates the SOAP message.
$location = I assume this is the location of the WSDL file? location (URL) of the service.
$action = don't know what these values could be SOAPAction HTTP request header (depends upon the service you are calling)
$version = not sure what these values could be either SOAP version (SOAP_1_1 or SOAP_1_2)In most cases you would probably just be modifying $request and leaving the rest untouched.
The documentation is a little lax so any additional info you could provide is appreciated. I've seen examples on the net where people are overriding __doRequest but the only part that is ever shown is the overriding class, not the part of code where they show how they're actually using their new class. Does anyone know of a COMPLETE example of using a class that extends SOAPClient? Something that expands upon what George has at his site at http://www.schlossnagle.org/~george/blog/index.php?/archives/235-Salesforce.com-and-PHP.html would be very helpful.http://www.cdatazone.org/index.php?/pages/source.html Take a look at any of the Example Usage of WS-* examples. Rob