enable SOAP XML logging when invoke web service
- Dominant language
- Java
- Stars
- 276
- Forks
- 223
- PR merge metrics
- No merged PRs in 30d
Description
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 !
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.