private EConnectFulfillOrderResponse ExecuteConnectFulfillOrder(string requestXML)
        {
            EConnectFulfillOrderResponse response = new EConnectFulfillOrderResponse();
            ConnectService.SupplierServiceSoapClient myConnect = new ConnectService.SupplierServiceSoapClient();

            Console.WriteLine(string.Format("BEGIN Invoke Connect Service to fulfill order"));
            Console.WriteLine();

            string responseXML = myConnect.ProcessMessage(requestXML);

            Console.WriteLine(string.Format("END Invoke Connect Service to fulfill order"));
            Console.WriteLine();

            XmlDocument xml = new XmlDocument();
            xml.LoadXml(responseXML);

            XmlNodeList xnList = xml.SelectNodes("/RTPSA_FulfillOrderRS");
            XmlNodeList xnListLineItems = xml.SelectNodes("/RTPSA_FulfillOrderRS/Order/LineItems/LineItem");

            foreach (XmlNode xn in xnList)
            {
                XmlNode nodeCode = xn.SelectSingleNode("ResponseCode");
                XmlNode nodeMessage = xn.SelectSingleNode("ResponseMessage");
                XmlNode nodeTransaction = xn.SelectSingleNode("TransactionId");

                if (nodeCode != null)
                {
                    response.ResponseCode = int.Parse(nodeCode.InnerText);
                }
                if (nodeMessage != null)
                {
                    response.ResponseMessage = nodeMessage.InnerText;
                }
                if (nodeTransaction != null)
                {
                    response.TransactionId = int.Parse(nodeTransaction.InnerText);
                }
            }

            foreach (XmlNode xn in xnListLineItems)
            {
                EConnectFulfillOrderDetailResponse detailResponse = new EConnectFulfillOrderDetailResponse();
                XmlNode nodeCode = xn.SelectSingleNode("ResponseCode");
                XmlNode nodeMessage = xn.SelectSingleNode("ResponseMessage");

                if (nodeCode != null)
                {
                    detailResponse.ResponseCode = int.Parse(nodeCode.InnerText);
                }
                if (nodeMessage != null)
                {
                    detailResponse.ResponseMessage = nodeMessage.InnerText;
                }

                detailResponse.IPCode = int.Parse(xn.Attributes["DistributorLineNumber"].Value);

                response.EConnectFulfillOrderDetailResponses.Add(detailResponse);
            }

            return response;
        }
        private EConnectCreateOrderResponse ExecuteConnectCreateOrder(string requestXML)
        {
            EConnectCreateOrderResponse response = new EConnectCreateOrderResponse();
            ConnectService.SupplierServiceSoapClient myConnect = new ConnectService.SupplierServiceSoapClient();

            Console.WriteLine(string.Format("BEGIN Invoke Connect Service to create order"));
            Console.WriteLine();

            string responseXML = myConnect.ProcessMessage(requestXML);

            Console.WriteLine(string.Format("END Invoke Connect Service to create order"));
            Console.WriteLine();

            XmlDocument xml = new XmlDocument();
            xml.LoadXml(responseXML);

            XmlNodeList xnList = xml.SelectNodes("/RTPSA_CreateOrderRS");

            foreach (XmlNode xn in xnList)
            {
                XmlNode nodeCode = xn.SelectSingleNode("ResponseCode");
                XmlNode nodeMessage = xn.SelectSingleNode("ResponseMessage");
                XmlNode nodeOrderID = xn.SelectSingleNode("SupplierOrderId");
                XmlNode nodeOrder = xn.SelectSingleNode("Order");

                if (nodeCode != null)
                {
                    response.ResponseCode = int.Parse(nodeCode.InnerText);
                }
                if (nodeMessage != null)
                {
                    response.ResponseMessage = nodeMessage.InnerText;
                }
                if (nodeOrderID != null)
                {
                    response.SupplierOrderID = int.Parse(nodeOrderID.InnerText);
                }
                if (nodeOrder != null && nodeOrder.Attributes["DistributorOrderId"] != null)
                {
                    response.DistributorOrderID = nodeOrder.Attributes["DistributorOrderId"].Value;
                }
            }

            return response;
        }