pszczyg

Untitled

Oct 18th, 2016
672
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private static string GetMessageWithEnvelope(ref Message request)
  2.         {
  3.             var buffer = request.CreateBufferedCopy(Int32.MaxValue);
  4.             request = buffer.CreateMessage();
  5.             var msg = buffer.CreateMessage();
  6.             var sb =
  7.                 new StringBuilder(
  8.                     $"<?xml version=\"1.0\" encoding=\"utf-8\"?>{Environment.NewLine}<soap:Envelope                     xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">{Environment.NewLine}"); //Dirty Hack To Add Envelope itself
  9.             using (
  10.                 var xw = XmlWriter.Create(sb,
  11.                     new XmlWriterSettings { Indent = true, Encoding = Encoding.UTF8, OmitXmlDeclaration = true }))
  12.                 msg.WriteBody(xw);
  13.  
  14.             sb.Append($"{Environment.NewLine}</soap:Envelope>"); //Dirty Hack To Add Envelope itself
  15.             return sb.ToString();
  16.         }
RAW Paste Data