/// <summary>
        /// RealWeb XML HTTP 통신 모듈 설정이다.
        /// </summary>
        /// <param name="uri">서버 URI</param>
        /// <param name="document">요청용 RclXmlDocument</param>
        /// <param name="isAsync">비동기 통신 여부</param>
        /// <param name="timeoutMilliseconds">통신 제한시간 (default : System.Threading.Timeout.Infinite)</param>
        /// <param name="userId"></param>
        /// <param name="password"></param>
        /// <returns>응답 XmlDocument</returns>
        public static XmlDoc Send(string uri,
                                  XmlDoc document,
                                  bool isAsync = false,
                                  int timeoutMilliseconds = System.Threading.Timeout.Infinite,
                                  string userId = null,
                                  string password = null) {
            uri.ShouldNotBeWhiteSpace("uri");

            if(IsDebugEnabled)
                log.Debug("Send xml document... uri=[{0}], isAsync=[{1}], timeout=[{2}], userId=[{3}], password=[{4}], document=[{5}]",
                          uri, isAsync, timeoutMilliseconds, userId, password, document);

            Guard.Assert(document.IsValidDocument(), @"document object is not valid document.");

            var xmlHttp = new XmlHttpClient(uri, isAsync, timeoutMilliseconds, userId, password);
            var xdoc = xmlHttp.Send(document);

            if(IsDebugEnabled)
                log.Debug("Send xml... uri=[{0}], result=[{1}]", uri, xdoc.Text);

            return xdoc;
        }
Beispiel #2
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;
        }