Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAS BOI and ASP.NET 1

Status
Not open for further replies.

gbaughma

IS-IT--Management
Staff member
Nov 21, 2003
4,772
US
Has anyone had any success using the MAS BOI not from a VBScript page, but instead from an ASP.NET web page?

I'm trying to write an in-house web application to process RMA's.

I'm not sure if I don't have my references correct, or perhaps my DCOM permissions.

Has anyone been able to do this?



Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
You don't have to use BOI in VBScript. You can use any programming language that accesses COM objects.

Have you taken the Sage class on BOI? It is detailed in the class.
 
  • Thread starter
  • Moderator
  • #3
Evidently, there's a limitation on using the COM object in ASP.NET, which is what I was attempting to do.

It would have been nice to make the BOI connection right from within the code-behind for my web page that I'm developing, but I'm not finding any information about it.

I haven't taken the sage class, however my predecessor left the BOI Programmer's Guide from when HE took the class, which I have gone through extensively (to the point of correcting all the typos and bugs in the book).

When I attempt to create the object from within ASP.NET, it gives me an error that it can't create the scripting object.



Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
Here is a quick bit of code I tried which successfully returns a list of open sales order numbers. The only other piece is to reference the Interop.Providex.dll

Also check out the Sage forums for lots of other code samples.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim oScript As Object
Dim oSS As Object

oScript = New ProvideX.Script
oScript.Init("C:\Program Files\Sage Software\MAS 90\Version4\MAS90\Home")
oSS = oScript.NewObject("SY_SESSION")

Dim retVal As Object
retVal = oSS.nLogon()
If retVal = 0 Then
retVal = oSS.nSetUser("username", "password")
End If
retVal = Nothing

' Setup the Session object for the company and module
retVal = oSS.nsetcompany("ABC")
retVal = oSS.nSetDate("S/O", Now.ToString("yyyyMMdd"))
retVal = oSS.nSetModule("S/O")

Dim strResult As String = String.Empty
Dim strJunk As String = String.Empty
Dim strColumns As String = String.Empty
Dim strKeys As String = String.Empty
Dim strFilter As String = String.Empty
Dim strBeginKey As String = String.Empty
Dim strEndKey As String = String.Empty

' Instantiate a business object
Dim oData As ProvideX.PvxDispatch
retVal = oSS.nSetProgram(oSS.nLookupTask("SO_SalesOrder_UI"))
oData = oScript.NewObject("SO_SalesOrder_BUS", oSS)

' Add the columns to return
strColumns = "SalesOrderNo$"

' Key columns
strKeys = "SalesOrderNo$"

' Filter to only load open orders
strFilter += "OrderStatus$=" + Chr(34) + "O" + Chr(34) 'N=new, O=open, C=Closed, H=Hold

' Retrieve the results from MAS
oData.nGetResultSets(strColumns, strKeys, strResult, strJunk, strFilter, strBeginKey, strEndKey)

' Split the data into a string array
Dim strResults() As String = Split(Mid(strResult, 3, Len(strResult) - 3), Chr(138))

' If there are sales orders then do something.
If strResults.Length > 0 Then
' Show data on the web page or do something else here.

End If

' Cleanup
oData.DropObject()
oData = Nothing

If oSS IsNot Nothing Then
oSS.nCleanUp()
oSS.DropObject()
oSS = Nothing
End If
oScript = Nothing
Catch ex As Exception

End Try
End Sub
 
  • Thread starter
  • Moderator
  • #5
Well, now that I've had time to get back to this.... here is the error that I'm getting:

A critical error has occurred.
Retrieving the COM class factory for component with CLSID {60503AB4-2D27-11D6-B249-00C04F50D575} failed due to the following error: 80080005.

I'm figuring this probably has to do with a security setting on the COM object... that's the path that I'm following at the moment anyway...



Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
My code sample above was run in debug mode in the VS IDE, so the security level was my interactive account. You will have to modify the security of the account running actual website to have the correct permissions once you deploy the page to IIS.
You should be able to find some online information on configuring the .config files and Component Services to allow access to a COM object. I don't remember the exact settings.
 
I'm not sure if this is still a problem, but I had to write a web service to read and write data to MAS via the business objects. I had to deal with the COM issue, so I thought I'd post my steps for fixing the problem. These can be tweaked to further lock down, but this provides a good start.

1. Create a service account used by the web service to access MAS.
- Open computer management, create the user account with a strong password. Add to the Administrators and IIS_WPG groups.
- The administrators group gives permission to access and launch the Interop.Providex.dll via Distributed COM
- The IIS_WPG group will be used to set the web site to run in a separate application pool to limit exposure
2. Create an application pool in IIS to run the web site.
- Add the new service account as the identity of the application pool
3. Create the web site and set the application pool of the web site to use the newly created application pool.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top