Пример #1
0
        private void DIS_GetBpList_Click(object sender, EventArgs e)
        {
            SBODI_Server.Node DISnode = null;
            string            strSOAPans = null, strSOAPcmd = null;

            System.Xml.XmlDocument xmlDoc = null;

            xmlDoc  = new System.Xml.XmlDocument();
            DISnode = new SBODI_Server.Node();

            strSOAPcmd = @"<?xml version=""1.0"" encoding=""UTF-16""?>" +
                         @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">" +
                         "<env:Header>" +
                         "<SessionID>" + DIS_SessionId + "</SessionID>" +
                         @"</env:Header>" +
                         "<env:Body>" +
                         @"<dis:GetBPList xmlns:dis=""http://www.sap.com/SBO/DIS"">" +
                         "<CardType>" + getCardtype(DIS_CardType.Text) + "</CardType>" +
                         "</dis:GetBPList>" +
                         "</env:Body>" +
                         "</env:Envelope>";

            strSOAPans = DISnode.Interact(strSOAPcmd);
            xmlDoc.LoadXml(strSOAPans);
            showXmlReturn(xmlDoc);
        }
Пример #2
0
        // This function returns an XML document of an empty Business Partner object
        // To do so, it calls DI Server asking the object BusinessPartners
        public System.Xml.XmlDocument GetEmptyBPXml()
        {
            SBODI_Server.Node n = null;
            string            s = null, strXML = null;

            System.Xml.XmlDocument d = null;

            d = new System.Xml.XmlDocument();
            n = new SBODI_Server.Node();

            strXML = @"<?xml version=""1.0"" encoding=""UTF-16""?>" +
                     @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">" +
                     "<env:Header>" +
                     "<SessionID>" + DIS_SessionId + "</SessionID>"
                     + @"</env:Header>" +
                     "<env:Body>" +
                     @"<dis:GetBusinessObjectTemplate xmlns:dis=""http://www.sap.com/SBO/DIS"">" +
                     "<Object>oBusinessPartners</Object>" +
                     "</dis:GetBusinessObjectTemplate>" +
                     " </env:Body>" +
                     "</env:Envelope>";

            s = n.Interact(strXML);
            d.LoadXml(s);

            return(RemoveEnv(d));
        }
Пример #3
0
        internal static EnvelopeResponse Execute(string command)
        {
            var sboServer = new SBODI_Server.Node();
            var result    = sboServer.Interact(command);

            var response = ParseXml <EnvelopeResponse>(result);

            ErrorHandler(response);
            return(response);
        }
Пример #4
0
        private void DIS_CreateBP_Click(object sender, EventArgs e)
        {
            //Formats XML with BP attributes
            System.Xml.XmlDocument xmlD   = null;
            System.Xml.XmlElement  xmlE   = null;
            System.Xml.XmlNodeList bpCode = null;
            System.Xml.XmlNode     bpName = null;


            xmlD = GetEmptyBPXml();
            xmlE = (System.Xml.XmlElement)xmlD.DocumentElement;

            xmlE.InnerXml = xmlE.InnerXml.Replace("<CardCode />", "<CardCode>" + DIS_BPCode.Text + "</CardCode>");
            xmlE.InnerXml = xmlE.InnerXml.Replace("<CardName />", "<CardName>" + "Inserted By DI Server at - " + DIS_BPCode.Text + "</CardName>");

            SBODI_Server.Node      node     = null;
            System.Xml.XmlDocument doc      = null;
            System.Xml.XmlDocument parseXML = null;

            doc  = new System.Xml.XmlDocument();
            node = new SBODI_Server.Node();

            string AddCmd = null;

            System.Xml.XmlNode netoXML = null;

            parseXML = new System.Xml.XmlDocument();
            parseXML.LoadXml(xmlE.OuterXml);

            netoXML = (RemoveEmptyNodes(parseXML));

            AddCmd = @"<?xml version=""1.0"" encoding=""UTF-16""?>" +
                     @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">" +
                     "<env:Header>" +
                     "<SessionID>" + DIS_SessionId + "</SessionID>" +
                     @"</env:Header>" +
                     "<env:Body>" +
                     @"<dis:AddObject xmlns:dis=""http://www.sap.com/SBO/DIS"">" +
                     netoXML.InnerXml +
                     "</dis:AddObject>" +
                     "</env:Body>" +
                     "</env:Envelope>";

            string res = null;

            res = node.Interact(AddCmd);
            doc.LoadXml(res);
            showXmlReturn(doc);
        }
Пример #5
0
        public static bool IsConnected(string key)
        {
            Dynamic token;

            if (!Tokens.Get(key, out token))
            {
                var diServer = new SBODI_Server.Node() as SBODI_Server.INode;

                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
        public string GetList(string sessionId)
        {
            SBODI_Server.Node DISnode = null;
            string            strSOAPans = null, strSOAPcmd = null;

            System.Xml.XmlDocument xmlDoc = null;

            xmlDoc  = new System.Xml.XmlDocument();
            DISnode = new SBODI_Server.Node();

            strSOAPcmd = @"<?xml version=""1.0"" encoding=""UTF-16""?>" + @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">" + "<env:Header>" + "<SessionID>" + sessionId + "</SessionID>" + @"</env:Header><env:Body><dis:GetBPList xmlns:dis=""http://www.sap.com/SBO/DIS"">" + "<CardType>" + "" + "</CardType>" + "</dis:GetBPList></env:Body></env:Envelope>";

            strSOAPans = DISnode.Interact(strSOAPcmd);
            xmlDoc.LoadXml(strSOAPans);


            return(strSOAPans); // xmlDoc.ToString();
        }
Пример #7
0
        public string GetAdminInfo(string sessionId)
        {
            SBODI_Server.Node DISnode = null;
            string            result  = null;

            DISnode = new SBODI_Server.Node();

            var soapCommand = @"<?xml version=""1.0"" encoding=""UTF-16""?>" +
                              @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">" +
                              "<env:Header><SessionID>" + sessionId + "</SessionID></env:Header>" +
                              @"<env:Body><dis:GetAdminInfo xmlns:dis=""http://www.sap.com/SBO/DIS"">" +
                              "<Service>CompanyService</Service>" +
                              "</dis:GetAdminInfo></env:Body></env:Envelope>";

            result = DISnode.Interact(soapCommand);
            var xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(result);
            return(xmlDoc.InnerXml);
        }
Пример #8
0
        public string GetBusinessObjectXmlSchema(string sessionId)
        {
            SBODI_Server.Node DISnode = null;
            string            result  = null;

            DISnode = new SBODI_Server.Node();

            var objectType  = "oCreditNotes";
            var soapCommand = @"<?xml version=""1.0"" encoding=""UTF-16""?>" +
                              @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">" +
                              "<env:Header><SessionID>" + sessionId + "</SessionID></env:Header>" +
                              @"<env:Body><dis:GetBusinessObjectXmlSchema xmlns:dis=""http://www.sap.com/SBO/DIS"">" +
                              "<Object>" + objectType + "</Object>" +
                              "</dis:GetBusinessObjectXmlSchema></env:Body></env:Envelope>";

            result = DISnode.Interact(soapCommand);
            var xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(result);
            return(xmlDoc.InnerXml);
        }
Пример #9
0
        private void DISConnect_Click(object sender, EventArgs e)
        {
            SBODI_Server.Node DISnode = null;
            string            sSOAPans = null, sCmd = null;

            DISnode = new SBODI_Server.Node();

            sCmd = @"<?xml version=""1.0"" encoding=""UTF-16""?>"
                   + @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">"
                   + @"<env:Body>"
                   + @"<dis:Login xmlns:dis=""http://www.sap.com/SBO/DIS"">"
                   + "<DatabaseServer>" + DataBaseServer + "</DatabaseServer>"
                   + "<DatabaseName>" + DataBaseName + "</DatabaseName>"
                   + "<DatabaseType>" + DataBaseType + "</DatabaseType>"
                   + "<DatabaseUsername>" + DataBaseUserName + "</DatabaseUsername>"
                   + "<DatabasePassword>" + DataBasePassword + "</DatabasePassword>"
                   + "<CompanyUsername>" + CompanyUserName + "</CompanyUsername>"
                   + "<CompanyPassword>" + CompanyPassword + "</CompanyPassword>"
                   + "<Language>" + Language + "</Language>"
                   + "<LicenseServer>" + LicenseServer + "</LicenseServer>"
                   + "</dis:Login>"
                   + "</env:Body>"
                   + "</env:Envelope>";

            sSOAPans = DISnode.Interact(sCmd);

            //  Parse the SOAP answer
            System.Xml.XmlValidatingReader xmlValid = null;
            string sRet = null;

            xmlValid = new System.Xml.XmlValidatingReader(sSOAPans, System.Xml.XmlNodeType.Document, null);
            while (xmlValid.Read())
            {
                if (xmlValid.NodeType == System.Xml.XmlNodeType.Text)
                {
                    if (sRet == null)
                    {
                        sRet += xmlValid.Value;
                    }
                    else
                    {
                        if (sRet.StartsWith("Error"))
                        {
                            sRet += " " + xmlValid.Value;
                        }
                        else
                        {
                            sRet = "Error " + sRet + " " + xmlValid.Value;
                        }
                    }
                }
            }

            if (sSOAPans.Contains("<env:Fault>"))
            {
                sRet = "Error: " + sRet;
            }
            else
            {
                DIS_SessionId = sRet;
                sRet          = "Connection ID: " + DIS_SessionId;
            }

            MessageBox.Show(sRet);
        }