private static String serializeRelyingPartyToken(final Element rpToken) throws Exception {
        val sw = new StringWriter();
        val transformerFactory = TransformerFactory.newInstance();
        transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        val t = transformerFactory.newTransformer();
        t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, BooleanUtils.toStringYesNo(Boolean.TRUE));
        t.transform(new DOMSource(rpToken), new StreamResult(sw));
        return sw.toString();
    }
This is {@link DefaultRelyingPartyTokenProducer}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-ws-idp/src/main/java/org/apereo/cas/ws/idp/services/DefaultRelyingPartyTokenProducer.java