Exemplo n.º 1
0
        /// <summary>
        /// This method overlays any answer collections passed into it, into a single XML answer collection.
        /// </summary>
        /// <param name="answers">The answers to be overlayed.</param>
        /// <param name="logRef">This parameter lets you specify information that will be included in usage logs for this call. For example, you can use a string to uniquely identify the end user that initiated the request and/or the context in which the call was made. When you review usage logs, you can then see which end users initiated each request. That information could then be used to pass costs on to those end users if desired.</param>
        /// <returns>The consolidated XML answer collection.</returns>
        public string GetAnswers(IEnumerable <System.IO.TextReader> answers, string logRef)
        {
            // Validate input parameters, creating defaults as appropriate.
            string logStr = logRef == null ? string.Empty : logRef;

            if (answers == null)
            {
                throw new ArgumentNullException("answers", "The answers collection must not be null, logRef: " + logStr);
            }

            BinaryObject combinedAnswers;

            using (SoapClient client = new SoapClient(_subscriberID, _signingKey, HostAddress, ProxyAddress))
            {
                var answerObjects = (from answer in answers select Util.GetBinaryObjectFromTextReader(answer)).ToArray();
                combinedAnswers = client.GetAnswers(answerObjects, logRef);
            }
            return(Util.ExtractString(combinedAnswers));
        }