/// <summary> /// Assembles a document from the given template, answers and settings. /// </summary> /// <param name="template">The template to assemble.</param> /// <param name="answers">The answers to use during the assembly.</param> /// <param name="settings">The settings for the assembly.</param> /// <include file="../../Shared/Help.xml" path="Help/string/param[@name='logRef']"/> /// <returns>An <c>AssembleDocumentResult</c> that contains the results of the assembly.</returns> public AssembleDocumentResult AssembleDocument(Template template, System.IO.TextReader answers, AssembleDocumentSettings settings, string logRef) { // Validate input parameters, creating defaults as appropriate. string logStr = logRef == null ? string.Empty : logRef; if (template == null) { throw new ArgumentNullException("template", string.Format(@"Cloud.Services.AssembleDocument: the ""template"" parameter passed in was null, logRef: {0}", logStr)); } if (settings == null) { settings = new AssembleDocumentSettings(); } AssembleDocumentResult result = null; AssemblyResult asmResult = null; using (var client = new SoapClient(_subscriberID, _signingKey, HostAddress, ProxyAddress)) { asmResult = client.AssembleDocument( template, answers == null ? "" : answers.ReadToEnd(), settings, logRef ); } if (asmResult != null) { result = Util.ConvertAssemblyResult(template, asmResult, settings.Format); } return(result); }