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

  • Home
  • SEARCH
  • 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 8416637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:49:04+00:00 2026-06-10T01:49:04+00:00

I’m building an xmlrpc client with Java using Apache xmlrpc, but couldn’t figure out

  • 0

I’m building an xmlrpc client with Java using Apache xmlrpc, but couldn’t figure out how to log the input/output xml (the raw data received and sent). How do I do this?

Thank you

  • 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-10T01:49:05+00:00Added an answer on June 10, 2026 at 1:49 am

    My work-around was to use a custom transport as follows. Perhaps there are more graceful ways of doing this.

    import java.io.BufferedReader;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    
    import org.apache.xmlrpc.XmlRpcException;
    import org.apache.xmlrpc.client.XmlRpcClient;
    import org.apache.xmlrpc.client.XmlRpcStreamTransport;
    import org.apache.xmlrpc.client.XmlRpcSunHttpTransport;
    import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
    import org.xml.sax.SAXException;
    
    
    /**
     * This is a custom XML-RPC transport which logs the outgoing and incoming
     * XML-RPC messages.
     */
    public class MessageLoggingTransport extends XmlRpcSunHttpTransport
    {
        private static final Logger log = Logger.getLogger(MessageLoggingTransport.class.getName());
    
    
        /**
         * Default constructor
         * 
         * @see XmlRpcSunHttpTransport#XmlRpcSunHttpTransport(XmlRpcClient)
         * @param pClient
         */
        public MessageLoggingTransport(final XmlRpcClient pClient)
        {
            super(pClient);
        }
    
    
        /**
         * Dumps outgoing XML-RPC requests to the log
         */
        @Override
        protected void writeRequest(final XmlRpcStreamTransport.ReqWriter pWriter) throws IOException, XmlRpcException, SAXException
        {
            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
            pWriter.write(baos);
            log.info(baos.toString());
            super.writeRequest(pWriter);
        }
    
    
        /**
         * Dumps incoming XML-RPC responses to the log
         */
        @Override
        protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException
        {
            final StringBuffer sb = new StringBuffer();
    
            try
            {
                final BufferedReader reader = new BufferedReader(new InputStreamReader(pStream));
                String line = reader.readLine();
                while(line != null)
                {
                    sb.append(line);
                    line = reader.readLine();
                }
            }
            catch(final IOException e)
            {
                log.log(Level.SEVERE, "While reading server response", e);
            }
    
            log.info(sb.toString());
    
            final ByteArrayInputStream bais = new ByteArrayInputStream(sb.toString().getBytes());
            return super.readResponse(pConfig, bais);
        }
    }
    

    And then in the code which creates your XML-RPC client:

    final XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    config.setServerURL(new URL(url));
    
    final XmlRpcTransportFactory transportFactory = new XmlRpcTransportFactory()
    {
        public XmlRpcTransport getTransport()
        {
            return new MessageLoggingTransport(client);
        }
    };
    
    client = new XmlRpcClient();
    client.setTransportFactory(transportFactory);
    client.setConfig(config);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

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.