SOAP Request and Response Envelopes
Posted: Fri Sep 14, 2007 12:25 am
I am working with Webservices and while connecting to a SOAP server I am able to execute the following code:
But I want to do logging of requests and responses at the Server End. For example at the Server end I can do the following:
The above gets me the Soap Request Envelope. Now I also want to capture whats going out as the SOAP response. But I am stuck. Any suggestions?
Code: Select all
$client = new SoapClient('wsdl_location', array("trace" => true, "exceptions" => true, 'soap_version' => SOAP_1_2));
// And for debuging the request and response I do this:
if ($debug)
{
print "<pre>\n";
print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
print "</pre>";
}Code: Select all
// Int theConstructor of the Webservices class I have:
$xml_request = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input");