Code example for DOMImplementationLS

Methods: createLSOutputcreateLSSerializer

0
 
            ByteArrayOutputStream byteArrayOutputStrm = new ByteArrayOutputStream();
            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
            DOMImplementationLS impl =
                    (DOMImplementationLS) registry.getDOMImplementation("LS");
            LSSerializer writer = impl.createLSSerializer();
            LSOutput output = impl.createLSOutput();
            output.setByteStream(byteArrayOutputStrm);
            writer.write(element, output);
            return byteArrayOutputStrm.toString();
        } catch (Exception e) {
            log.error("Error Serializing the SAML Response");
            throw new IdentityException("Error Serializing the SAML Response", e);
        } 
    } 
 
    private static Issuer getIssuer() { 
        Issuer issuer = new IssuerBuilder().buildObject();
        issuer.setValue("WSO2 Identity Server");
        issuer.setFormat("urn:oasis:names:tc:SAML:2.0:nameid-format:entity");