I've got a number of web services scripts, each of which comprises a lot of different SOAP requests. I now want to be able to trap and report the contents of these requests - by which I mean the value of the SOAPEnvelope element - in the event of them failing.

Now I could go back and rework the scripts to build up the request contents as a string in each case, then use that string as the content of SOAPEnvelope. This would then of course give me access to that string for reporting purposes. But that's a lot of rework. What I'm hoping is that I can address the SOAPEnvelope element directly after making the request.

Any ideas, please?