Exemplo n.º 1
0
        /// <summary>
        /// Processes the XML Request
        /// </summary>
        /// <param name="p_sRequestURL">URL for Request XML</param>
        /// <param name="p_sRequestXML">Request XML</param>
        /// <param name="p_ErrorInfo">Contains additional error information.</param>
        /// <returns></returns>
        private string ProcessRequest(string p_sRequestURL, string p_sRequestXML, string p_ErrorInfo)
        {
            SendReceiveXMLMessage oSendRecieve = new SendReceiveXMLMessage();

            oSendRecieve.RequestXMLBody = p_sRequestXML;
            oSendRecieve.URL            = p_sRequestURL;
            oSendRecieve.Method         = "POST";
            oSendRecieve.ContentType    = "application/xml";
            oSendRecieve.SendMsgToEF();
            string sResponse       = oSendRecieve.ResponseXML;
            string sStatusResponse = string.Empty;
            string status          = string.Empty;

            try
            {
                if (!string.IsNullOrEmpty(sResponse))
                {
                    XDocument document      = null;
                    bool      ResponseIsXML = true;

                    try
                    {
                        document = XDocument.Parse(sResponse);
                    }
                    catch (Exception)
                    {
                        ResponseIsXML = false;
                        status        = "FAILURE";
                        p_ErrorInfo   = string.Format("Received the following response message from the WriteBack WEB Request: {0}{1}{1}This is not a valid XML message.", sResponse, System.Environment.NewLine);
                    }

                    if (ResponseIsXML)
                    {
                        XNamespace s1 = "http://schemas.xmlsoap.org/soap/envelope/";
                        XNamespace x  = "http://www.informatica.com/wsdl/";

                        status = document.Element(s1 + "Envelope")
                                 .Element(s1 + "Body")
                                 .Element(x + "WMIS_WSH_GIS_WRITEBACKResponse")
                                 .Element(x + "WMIS_WSH_GIS_WRITEBACKResponseElement")
                                 .Element(x + "Status").Value;
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(status);
        }
Exemplo n.º 2
0
        private string ProcessRequest(string p_sRequestURL, string p_sRequestXML, out string p_errorInfo)
        {
            p_errorInfo = string.Empty;
            string status = "SUCCESS";
            SendReceiveXMLMessage oSendRecieve = new SendReceiveXMLMessage(p_sRequestURL, p_sRequestXML, "POST");

            oSendRecieve.SendMsgToEF();
            string sResponse = oSendRecieve.ResponseXML;

            if (!string.IsNullOrEmpty(sResponse))
            {
                bool        ResponseIsXML = true;
                XmlDocument documentXML   = new XmlDocument();

                try
                {
                    documentXML.LoadXml(sResponse); //loading soap message as string
                }
                catch (Exception)
                {
                    ResponseIsXML = false;
                    status        = "FAILURE";
                    p_errorInfo   = string.Format("Received the following response message from the ProcessJobStatus WEB Request: {0}{1}{1}This is not a valid XML message.", sResponse, System.Environment.NewLine);
                }

                if (ResponseIsXML)
                {
                    string sStatusResponse = documentXML.ChildNodes[1].ChildNodes[0].ChildNodes[0].InnerText;
                    status = sStatusResponse.Trim().Equals("SUCCESS") ? "SUCCESS" : "FAILURE";

                    if (status.Equals("FAILURE"))
                    {
                        p_errorInfo = documentXML.ChildNodes[1].ChildNodes[0].ChildNodes[2].InnerText;
                    }
                }
            }
            else
            {
                status      = "FAILURE";
                p_errorInfo = string.Format("Received an empty response message from the WriteBack WEB Request.");
            }

            return(status);
        }