Pretty Print SOAP Message and Display the SOAP message in HTML

In some situations it could be useful to pretty print a SOAP message to be able to show it in a html page.
Often applications that uses web services needs to log the SOAP messages that is sent to and from the services and then display them in some sort of administration application.
It would also perhaps be nice not to use the pre-tag but to embed the code along the rest of the html code.
In such a case the pretty print comes in handy. This example shows how to pretty print a SOAP message reading the unformatted envelope from a file, formats (pretty print) the message and writes it to a html file.

This is what the SOAP message looks like when it is pretty printed and displayed as html:

Search for more Java info on this site here:
Custom Search

Please type any questions here.