MAS BOI and ASP.NET
MAS BOI and ASP.NET
(OP)
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?
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 http://parallel.tzo.com
RE: MAS BOI and ASP.NET
Have you taken the Sage class on BOI? It is detailed in the class.
RE: MAS BOI and ASP.NET
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 http://parallel.tzo.com
RE: MAS BOI and ASP.NET
Also check out the Sage forums for lots of other code samples.
http://
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
RE: MAS BOI and ASP.NET
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 http://parallel.tzo.com
RE: MAS BOI and ASP.NET
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.
RE: MAS BOI and ASP.NET
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.