Skip to Content

How to run a web Application with the help of DI SERVER?

Dear Experts,

I am creating a web application.In my web application "How can I access a DI server and run the application with the help of DI server?"

1.How to Link a DI server with Web Application ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 09, 2017 at 05:32 AM

    Hi,

    Your Web Application should have the reference to DI Server. Later, you can send the common XML structure to DI Server to operate the Add, Update Methods for different business objects.

    Here is one similar discussion that you can refer.

    Also refer to SDK Help Center for the same.

    Hope it helps! All the best!

    Kind regards,

    ANKIT CHAUHAN

    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      I would ask you to refer to SDK Help Center once. Here is a sample to use the DI Server to make the company connection:

      1. To connect to the company database using DI Server:

      initScriptPath = System.Windows.Forms.Application.StartupPath + "\\";
      
      
                      string users = null;
                      string Response = null;
                      string SessionID = null;
                      string sCmd = null;
      
                      SBODI_Server.Node DISnode = default(SBODI_Server.Node);
                      DISnode = new SBODI_Server.Node();
      
      
                      dynamic cmd = "<?xml version=\"1.0\" encoding=\"UTF-16\"?>";
                      cmd += "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">";
                      cmd += "<env:Body><dis:Login xmlns:dis=\"http://www.sap.com/SBO/DIS\">";
                      cmd += "<DatabaseServer>DEWDFWTEC4209</DatabaseServer>";
                      cmd += "<DatabaseName>SBODEMOIN</DatabaseName>";
                      cmd += "<DatabaseType>dst_MSSQL2012</DatabaseType>";
                      cmd += "<DatabaseUsername>sa</DatabaseUsername>";
                      cmd += "<DatabasePassword>Welcome1</DatabasePassword>";
                      cmd += "<CompanyUsername>manager</CompanyUsername>";
                      cmd += "<CompanyPassword>ankit</CompanyPassword>";
                      cmd += "<Language>ln_English</Language>";
                      cmd += "<LicenseServer>DEWDFWTEC4209:30000</LicenseServer>";
                      cmd += "</dis:Login></env:Body></env:Envelope>";
      
      
                      Response = DISnode.Interact(cmd);

      2. Write the Response to XML:

      WriteXML(Response, "Login_Response.xml");
      
      Where WriteXML() is defined as below:
      
      
      private void WriteXML(string FileContent, string Filename)
              {
                  System.IO.StreamWriter oWrite = null;
                  oWrite = System.IO.File.CreateText(initScriptPath + Filename);
                  oWrite.Write(FileContent);
                  oWrite.Close();
              }
      

      3. To Extract/Get the Session ID after the connection.

      SessionID = ExtractSessionID("Login_Response.xml");
      
      Where ExtractSessionID() is defined as below:
      
      
      public string ExtractSessionID(string Filename)
              {
                  string ResponseXML = null;
                  int i = 0;
                  int j = 0;
      
      
                  ResponseXML = ReadXML(Filename);
      
      
                  if (ResponseXML.Contains("SessionID"))
                  {
                      //i = ResponseXML.IndexOf("<SessionID>") + Strings.Len("<SessionID>");
                      i = (ResponseXML.IndexOf("<SessionID>") + "<SessionID>".Length);
                      j = ResponseXML.IndexOf("</SessionID>");
                      return ResponseXML.Substring(i, j - i);
                  }
                  else
                  {
                      return "";
                  }
              }
      

      Hope it helps!

      Kind regards,

      ANKIT CHAUHAN

      SAP SME Support