SOAP Request and Response Envelopes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

SOAP Request and Response Envelopes

Post by jeffery »

I am working with Webservices and while connecting to a SOAP server I am able to execute the following code:

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>";
		}
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:

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");
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?
mrkite
Forum Contributor
Posts: 104
Joined: Tue Sep 11, 2007 4:19 am

Post by mrkite »

If you want to see what's really going on. Run something like tcpflow on either the client or the server.
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

Post by jeffery »

No I need to log into the database what is being requested and the response to it. tcpflow maybe good for real time monitoring.
mrkite
Forum Contributor
Posts: 104
Joined: Tue Sep 11, 2007 4:19 am

Post by mrkite »

jeffery wrote:No I need to log into the database what is being requested and the response to it. tcpflow maybe good for real time monitoring.
Oh, I see. You could use ob_start() to run the output of the script through a callback.. I believe the SOAP response would get sent through it.
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

Post by jeffery »

mrkite wrote:
jeffery wrote:No I need to log into the database what is being requested and the response to it. tcpflow maybe good for real time monitoring.
Oh, I see. You could use ob_start() to run the output of the script through a callback.. I believe the SOAP response would get sent through it.
ah damn.. why didn't I think of that... Thanks mrkite Problem Solved :)
Post Reply