Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8106717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:32:56+00:00 2026-06-06T00:32:56+00:00

I have been fiddling around with server side interceptors on CXF. But is seems

  • 0

I have been fiddling around with server side interceptors on CXF. But is seems that it is not a trivial task to implement simple incoming and outgoing interceptors that give me a plain string containing the SOAP XML.

I need to have the plain XML in the interceptor so that I can use them for specific logging tasks. The standard LogIn & LogOut interceptors are not up to the task. Is anyone willing to share some example on how I could implement a simple incoming interceptor that is able to get the incoming SOAP XML and a outgoing interceptor to again get the SOAP XML?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:32:59+00:00Added an answer on June 6, 2026 at 12:32 am

    Found the code for an incoming interceptor here:
    Logging request/response with Apache CXF as XML

    My outgoing interceptor:

    import java.io.OutputStream;
    
    import org.apache.cxf.interceptor.Fault;
    import org.apache.cxf.interceptor.LoggingOutInterceptor;
    import org.apache.cxf.io.CacheAndWriteOutputStream;
    import org.apache.cxf.io.CachedOutputStream;
    import org.apache.cxf.io.CachedOutputStreamCallback;
    import org.apache.cxf.message.Message;
    import org.apache.cxf.phase.Phase;
    
    public class MyLogInterceptor extends LoggingOutInterceptor {
    
        public MyLogInterceptor() {
            super(Phase.PRE_STREAM);
        }
    
        @Override
        public void handleMessage(Message message) throws Fault {
            OutputStream out = message.getContent(OutputStream.class);
            final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(out);
            message.setContent(OutputStream.class, newOut);
            newOut.registerCallback(new LoggingCallback());
        }
    
        public class LoggingCallback implements CachedOutputStreamCallback {
            public void onFlush(CachedOutputStream cos) {
            }
    
            public void onClose(CachedOutputStream cos) {
                try {
                    StringBuilder builder = new StringBuilder();
                    cos.writeCacheTo(builder, limit);
                    // here comes my xml:
                    String soapXml = builder.toString();
                } catch (Exception e) {
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been fiddling around with lambda expressions to learn how they work but
I have this, and i've been fiddling around with it for a while but
I Have been fiddling with this for hours. I can not get my text
I've been fiddling around with CHESS , which seems like an incredibly useful tool.
I have been fiddling around with Namespace in PHP and was trying to make
I've been fiddling around with drupal theming quite succesfully (or at least, that's what
I have been fiddling around with settings for a while, and cannot seem to
I have been fiddling with code to call a function with the name of
Have been trying to encrypt an xml file to a string so that I
Have been looking on some tutorials for drawing canvas using SurfaceView, but the only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.