Thursday, December 22, 2011

CXF logging of inbound and outbound messages

Add the following snippet to beans.xml
<!-- Following logs all inbound and outbound messages -->
    <cxf:bus>
        <cxf:features>
            <cxf:logging />
        </cxf:features>
    </cxf:bus>

This will record all the inbound and outbound messages.

Note: I found an issue using the LoggingOutInterceptor explicitly.  On a SOAP Fault, the outgoing message would not be recorded if you used the LoggingOutInterceptor.  Using the logging feature on the bus fixed it, also, you will only have to define the logging once and it will work for all the services defined in the beans.xml.






Thursday, December 1, 2011

XML Parsing error

Sometimes while parsing an xml document, you might hit the following error:
[Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.

This cryptic error is because the xml-string has whitespace preceeding the <xml ..> tag.  Use trim() to get rid of the whitespace and off you go!