Java tutorial
//package com.java2s; import javax.xml.soap.SOAPMessage; import java.io.ByteArrayOutputStream; import java.io.IOException; public class Main { public static String soapMessageToString(SOAPMessage message) { String result = null; if (message != null) { ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); message.writeTo(baos); result = baos.toString(); } catch (Exception e) { } finally { if (baos != null) { try { baos.close(); } catch (IOException ioe) { } } } } return result; } }