Storing Soap Server Response to XML File Log

Dave Bnski
  • Dave Bnski
    Dave Bnski

    To aid in troubleshooting user issues with my web service I'd like to log both the request and response to a local XML file.

    (actually saving it to Amazon S3)

    The request is easy:

    $s3 = new AmazonS3();
    $soap_request = (string) $HTTP_RAW_POST_DATA;
    $log_request = $s3->create_object('log_bucket', 'request.xml', array('body' => $soap_request));

    How do I save the soap services response as a string and write it to a xml file?

    I am unable to (string) type cast the response:

    $soap_response = (string) $server->service($HTTP_RAW_POST_DATA);

    Any other way?