static String xmlObjectToString(XMLObject xmlObject) throws Exception{
MarshallerFactory marshallerFactory = Configuration.getMarshallerFactory();
Marshaller marshaller = marshallerFactory.getMarshaller(xmlObject);
Element samlObjectElement = marshaller.marshall(xmlObject);
Transformer transformer = TransformerFactory.newInstance().newTransformer();
//transformer.setOutputProperty(OutputKeys.INDENT, "yes");
StreamResult result = new StreamResult(new StringWriter());
DOMSource source = new DOMSource(samlObjectElement);
transformer.transform(source, result);
return result.getWriter().toString();
}