cancel
Showing results for 
Search instead for 
Did you mean: 

SAP B1WS Login Service Program in C#

Former Member
0 Kudos

Hi,

I have created the program in C# for LoginService.



public partial class Login : System.Web.UI.Page

{

    LoginServices.LoginService Lgvsrv = new LoginServices.LoginService();

  

    string DatabaseServer = "NIKUNJ-PC";

    string DatabaseName = "NewMaster";

    string LicenceServer = "NIKUNJ-PC";

    protected void Page_Load(object sender, EventArgs e)

    {

    }

    protected void Login1(string abc)

    {

             string sessionID;

             Lgvsrv = new LoginServices.LoginService();

             sessionID = Lgvsrv.Login(DatabaseServer, DatabaseName, LoginServices.LoginDatabaseType.dst_MSSQL2008, true, "manager", "avr123",                                         LoginServices.LoginLanguage.ln_English, true, LicenceServer);

      

    }

    protected void btnconnect_Click(object sender, EventArgs e)

    {

     

                  Login1(TextBox1.Text);

                  MySample.GlbData.sessioniD = TextBox1.Text;

                  if (TextBox1.Text != "")

                  {

                      btnconnect.Enabled = false;          

                      btndiscon.Enabled = true;

                  }

    }

    protected void btndiscon_Click(object sender, EventArgs e)

    {

       // lblmsg.Text = "";

    

    }

    protected void btnlogin_Click(object sender, EventArgs e)

    {

        // this.Login();

        //  TextBox1.Text = Login

        //  MySample.GlbData.sessionID = TextBox1.Text;

    }

}

But it give me error image like,

i attach image which give me error.

e1.jpg

Thanks,

Nikunj

Accepted Solutions (0)

Answers (1)

Answers (1)

maik_delly
Active Contributor
0 Kudos

Hi Nikunj,

this is error is produced by wrong preferences for IIS / SBODI_Server.

Make sure to follow the instructions in B1WS.doc ( contained in B1WS folder ) - especially the DCOMCNFG part.

Apart from that it would be helpful to get the whole IIS error page ( error can also be connected to application pool or asp.net issues ).

regards,

Maik

Former Member
0 Kudos

Hi Mike,

I went through the procedure once again. All is done properly. I am facing the similar issue in two different machines.

I am attaching the error page here.

I would also like to know, if the SAP DI server License is required to run this?

Also let me know the code given above is proper? or there are any issues with the code?

regards,

Nikunj

                View Nikunj Mehta's profile on LinkedIn           

maik_delly
Active Contributor
0 Kudos

For this example to work you don't need a DIS license - but of course you cannot login or do any transactions to DI Server: The answer will be : you don't have a required license to run this.

As for your issue : I remember having a similar/same error and I fixed it using the information from here :

http://msdn.microsoft.com/en-us/library/hh169179%28v=nav.71%29.aspx

Your code looks ok.

regards,

Maik

Former Member
0 Kudos

Hi Maik,

as per suggestion , i can view above link.

But now it will give me new error like,

"Cannot connect to licence server"

but in real there is licence server is on.

Thanks

Nikunj

maik_delly
Active Contributor
0 Kudos

Hi Nikunj,

this is already a big step...

This error is usually fixed by using the IP address of the license server ( with port 30000 ).

Instead of :

string LicenceServer = "NIKUNJ-PC";

use the IP + port :

string LicenceServer = "192.168.1.100:30000"; // Afaik In recent versions the port can be left out

regards,

Maik