Beispiel #1
0
        /// <summary>
        /// Posting request xml document to server
        /// </summary>
        /// <param name="requestDoc"></param>
        /// <returns></returns>
        public XmlDoc Send(XmlDoc requestDoc)
        {
            requestDoc.ShouldNotBeNull("requestDoc");
            Guard.Assert(requestDoc.IsValidDocument(), @"requestDoc is not valid xml document.");

            XmlDoc responseDoc = null;

            try {
                responseDoc = (XmlDoc)PostXml(requestDoc);
            }
            catch (Exception ex) {
                if (responseDoc.IsValidDocument())
                {
                    responseDoc.AddElement(responseDoc.Root, "ERROR", ex.Message);
                }

                else
                {
                    if (log.IsErrorEnabled)
                    {
                        log.ErrorException("Error occurred in Send() method.", ex);
                    }

                    throw;
                }
            }

            return(responseDoc);
        }