Hi everyone,

I'm using CXF to develop a secure web services implementation.

My aim is to print the XML before encryption and after encryption on the
server.

I have been able to print the encrypted message once it is received by the
server via an "AbstractPhaseInterceptor" that I wrote myself.
I have then written another "AbstractPhaseInterceptor" which is meant to
print the decrypted message.

I am using the following constructor:

public DecryptedPayloadFileSaverInterceptor() {
        super(Phase.POST_PROTOCOL);
    }

I then do something like this in my handleMessage(Message msg) method:

@Override
    public void handleMessage(Message msg) throws Fault {
        origMsg = msg;
        XMLStreamReader xsr = origMsg.getContent(XMLStreamReader.class);
...

This works and I get a reference to the XMLStreamReader. Now what I would
like to do is print the contents of the XMLStreamReader to a file.
Does anyone know how to do this?

I've found a few references via google, however they use Axiom and I can't
seem to get Axiom to work with cxf. Does anyone know how?

This is using axiom and I can't get this to work:

---------------
XMLStreamReader xsr = origMsg.getContent(XMLStreamReader.class);
OMElement omElement = new StAXOMBuilder(xsr).getDocumentElement();
String xml = omElement.toStringWithConsume();
--------------
This generates the following stack trace: http://pastebin.com/WMFWVdmy

Maybe I'm on the wrong track and there is a better way of printing out the
decrypted SOAP message (before it get's handed of to the service that is
being invoked). Please let me know.

Regards, Sebastian.

Reply via email to