/// <summary> /// Generates an XML representation of operation envelope. /// </summary> /// <param name="signatureProvider">A signature provider object to calculate signature for operation.</param> /// <returns>An XMl representation of operation envelope.</returns> public virtual XElement ToOperationEnvelopeXml(SignatureProvider signatureProvider) { return new XElement(OperationEnvelopeNodeName, new XElement(OperationXmlNodeName, Convert.ToBase64String(Encoding.ASCII.GetBytes(ToXml().ToString()))), new XElement(SignatureNodeName, signatureProvider.GenerateSignature(this.ToXml().ToString())) ); }
/// <summary> /// Generates html code for hidden field with signature xml /// </summary> /// <param name="signatureProvider"> /// SignatureProvider object which will be used by this instance to generate signature. /// </param> /// <returns>A XElement object.</returns> protected XElement ToSignatureHtml(SignatureProvider signatureProvider) { string signature = signatureProvider.GenerateSignature(ToXml().ToString()); return new XElement( "input", new XAttribute("type", "hidden"), new XAttribute("name", "signature"), new XAttribute("value", signature)); }