Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable SOAP XML logging when invoke web service #95

Open
kiwionly opened this issue May 15, 2015 · 0 comments
Open

enable SOAP XML logging when invoke web service #95

kiwionly opened this issue May 15, 2015 · 0 comments

Comments

@kiwionly
Copy link

Hi,

I need to see what actually is send and received when something is failing, I review the code and see like that is no logging for this.

the code is pretty simple to implements:

make a decorator Writer:

private class EchoWriter extends Writer
{
    Writer out;

    StringBuilder buf = new StringBuilder();

    public EchoWriter(Writer out)
    {
        this.out = out;
    }

    public void write(String b) throws IOException
    {
        buf.append(b);
        out.write(b);
    }

    public void write(int b) throws IOException 
    {           
        buf.append((char)b);
        out.write(b);
    }

    public void write(char[] b) throws IOException 
    {           
        //System.out.print(b);
        out.write(b);           
    }

    public void write(String b, int offset, int len) throws IOException 
    {       
        //System.out.print(b);
        out.write(b, offset, len);          
    }

    public void write(char[] b, int offset, int len) throws IOException 
    {           
        //System.out.print(b);
        out.write(b, offset, len);          
    }

    public void close() throws IOException
    {
        out.close();
    }

    public void flush() throws IOException
    {
        System.out.println(buf.toString());  //logging start here
        System.out.println("-----------------");            
        buf = new StringBuilder();

        out.flush();
    }
}

add it to

MXSerializer.java

out = new EchoWriter(new OutputStreamWriter(os));

and that it !

@kiwionly kiwionly changed the title enabled SOAP XML logging when invoke web service enable SOAP XML logging when invoke web service May 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant