Skip to content

Instantly share code, notes, and snippets.

@Khunpisit
Created November 21, 2016 10:04
Show Gist options
  • Save Khunpisit/f423b243d08233e89424ccd641af668b to your computer and use it in GitHub Desktop.
Save Khunpisit/f423b243d08233e89424ccd641af668b to your computer and use it in GitHub Desktop.
private String getStringMessage(MessageContext context){
String res = null;
try {
SOAPMessageContext ctx = (SOAPMessageContext) context;
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ctx.getMessage().writeTo(stream);
byte[] items = stream.toByteArray();
res = new String(items);
}
catch(Exception e){
// nothing - just ensuring the method will not throw an exception in case something is wrong.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment