cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to DI APi from web application

Former Member
0 Kudos

Hey All,

Does anyone have any sample code to share for connecting to DI API from a web application without using DI Server?

Are there any specific permissions changes you need to make to either IIS, ASP or the server?

We try to execute the same company connection code that we use in the windows client app examples and we get a general license server error or failure to connect to license server. I can login to business one with no problems and all the client apps using DI API work fine.

Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try to have a look at my answer and code sample in: 'ASP.Net and SAPbobsCOM newby'

Former Member
0 Kudos

Thanks Gerd. That is exactly what we are trying to do now.

Answers (3)

Answers (3)

Gianluigi
Product and Topic Expert
Product and Topic Expert
0 Kudos

> Most comments and posts that I have heard about DI

> server have not been postive. Many users are talking

> about incomplete functionality and incorrect

> functionality. Of course we would love to take

> advantage of DI server.

DI Server will provide you a SOAP interface to the same functionality exposed via COM by DIAPI. There are a very few exceptions to this general rule: namely, there is no metadata support and you cannot spawn a transaction across several objects.

But apart this, you will get the same CRUD interface to the B1 objects than DIAPI, with the difference that the interface is SOAP and not COM.

Have a look to this:

/people/sap.user72/blog/2006/05/29/getting-started-with-di-server

Former Member
0 Kudos

Why exactly would you want to bypass DI Server in an ASP.NET application in the first place? DI API does not handle well situations in which there are potentially a lot of simultaneous connections being opened and closed in a short timeframe. This is a typical scenario for a web application.

IMHO DI Server is pretty nicely priced (I just hope they will stick to the current per-cpu licensing model) and would save you from a lot of fuss compared with any roll-your-own kludge built on top of DI API.

That said, in order to optimize the performance of an ASP.NET/SBO application, also DI Server should be used only for the operations that absolutely require it (such as adding documents or masterdata to the database). Any data retrieval is much more efficiently handled via direct database connection (with ADO.NET, for instance) than either with DI API or DI server.

Henry

Former Member
0 Kudos

Hey Henry,

Thanks very much for the posting. A couple of the reasons we are considering using DI API instead of DI API are:

1) Most comments and posts that I have heard about DI server have not been postive. Many users are talking about incomplete functionality and incorrect functionality. Of course we would love to take advantage of DI server.

2) I cannot seem to find any information about the cost of DI Server, support for future versions, updates for SBO 2005 SP1 etc... It seems as though no SAP people want to comment on DI server.

Former Member
0 Kudos

Hi Henry,

we tried DI-Server as well as DI-API but considered to use DI-API because our load wouldn't be very big.

Last year (on 2004A) we build a webapp as well based on DI-Server. But when migrating it to 2005A we were faced with the same problems as I descibed earlier in the thread with the DI-API using C#:

We can't get a stable connection to the server.

So I would suggest to use for the DI-Server also a VB wrapper for creating the connection.

Former Member
0 Kudos

But all this doesn't answer the question. How to connect with the DI API via ASP.NET

or I missed a line somewhere.

I din't find any documentation on how to do it yet.

Thanx

Former Member
0 Kudos

Hi Marc,

In 'ASP.Net and SAPbobsCOM newby' I put some code to connect to DI-Api. You'll find it at

Hope it helps.

Gerd

Former Member
0 Kudos

Oh, that is VB.NET code ? Why that doesn't work in C# ?

Except a few lines like .ListenServer that I never used

but it is the same code as yours.

If I dont have any choice I will make the little dll in vb.net then

Former Member
0 Kudos

> Hi Marc,

>

> In 'ASP.Net and SAPbobsCOM newby' I put some code to

> connect to DI-Api. You'll find it at

>

> adID=134629&language=en

>

> Hope it helps.

>

> Gerd

Is it necessary to have DBUserName, DBPassword + Username, Password ? Because in a WINDOWS APPLICATION it works find just with the UserName and Password

Former Member
0 Kudos

Hi Marc,

That depends on your SQL-Server login-settings:

If you use a 'Trusted Connection' you don't need a DBUserName or a DBPassword because this is done automatically by the Windows system.

Otherwise you need it because DI-Api needs them to create it's connection-string to the DB.

Gerd

Former Member
0 Kudos

> Hi Marc,

>

> That depends on your SQL-Server login-settings:

> If you use a 'Trusted Connection' you don't need a

> DBUserName or a DBPassword because this is done

> automatically by the Windows system.

> Otherwise you need it because DI-Api needs them to

> create it's connection-string to the DB.

>

> Gerd

All right. Well it seems that even there the connection always fails -111 Failed to connect. I'm still looking why it doesn't connect in ASP.NET but in a Windows Application it connect very well. It remains a mystery for now

Former Member
0 Kudos

Here's the code that works well in a WINDOWS APPLICATION.

Would it be the same in an ASP.NET app ?

SAPbobsCOM.Company oCompany = new SAPbobsCOM.CompanyClass();

oCompany.Server = Server;

oCompany.CompanyDB = CompanyDB;

oCompany.UserName = UserName;

oCompany.Password = Password;

oCompany.language = Lang;

oCompany.UseTrusted = true;

oCompany.Connect();

return oCompany;

Former Member
0 Kudos

in ASP.NET the message I got is

-111 Failed to Connect to SBOCommon

Former Member
0 Kudos

> in ASP.NET the message I got is

>

> -111 Failed to Connect to SBOCommon

Maybe a security issue ?

Former Member
0 Kudos

Hi Curtis,

The user that runs the web application is the ASP.Net user. So you will have to give this user the same permissions as you give to other users (DCOM permissions).

Hope helps,

Ibai Peñ