/// <summary>
        /// Retrieves a file required by the interview. This could be either an interview definition that contains the 
        /// variables and logic required to display an interview (questionaire) for the main template or one of its 
        /// inserted templates, or it could be an image file displayed on a dialog within the interview.
        /// </summary>
        /// <param name="template">The template related to the requested file.</param>
        /// <param name="fileName">The file name of the image, or the file name of the template for which the interview
        /// definition is being requested. In either case, this value is passed as "template" on the query string by the browser interview.</param>
        /// <param name="fileType">The type of file being requested: img (image file), js (JavaScript interview definition), 
        /// or dll (Silverlight interview definition).</param>
        /// <returns>A stream containing the requested interview file, to be returned to the caller.</returns>
        public Stream GetInterviewFile(Template template, string fileName, string fileType)
        {
            // Validate input parameters, creating defaults as appropriate.
            if (template == null)
                throw new ArgumentNullException("template", @"WebService.Services.GetInterviewFile: the ""template"" parameter passed in was null");

            if (string.IsNullOrEmpty(fileName))
                throw new ArgumentNullException("fileName", @"WebService.Services.GetInterviewFile: the ""fileName"" parameter passed in was null or empty");

            if (string.IsNullOrEmpty(fileType))
                throw new ArgumentNullException("fileType", @"WebService.Services.GetInterviewFile: the ""fileType"" parameter passed in was null or empty");

            // Return an image or interview definition from the template.
            InterviewFormat format = InterviewFormat.Unspecified;
            switch (fileType.ToUpper())
            {
                case "IMG":
                    return template.Location.GetFile(fileName);
                case "DLL":
                    format = InterviewFormat.Silverlight;
                    break;
                case "JS":
                    format = InterviewFormat.JavaScript;
                    break;
            }

            if (format == InterviewFormat.Unspecified)
                throw new ArgumentOutOfRangeException(); // The format must be either JS or DLL.

            System.IO.Stream result = null;

            using (Proxy client = new Proxy(_endPointName))
            {
                string templateId = GetRelativePath(Path.Combine(Path.GetDirectoryName(template.GetFullPath()), fileName)); // The relative path to the template folder.
                string templateName = fileName; // The name of the template file for which the interview is being requested (e.g., demoempl.rtf).
                string templateState = string.Empty; // We are using the templateId rather than template state since all we have to work with is a template locator.
                BinaryObject binaryObject = client.GetInterviewDefinition(templateId, templateName, format, templateState);
                SafeCloseClient(client, null);
                result = new MemoryStream(binaryObject.Data);
            }
            return result;
        }