×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

MAS BOI and ASP.NET

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?

 

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 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.

RE: MAS BOI and ASP.NET

(OP)
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  http://parallel.tzo.com
 

RE: MAS BOI and ASP.NET

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.
http://community.sagemas.com/t5/Business-Object-Interface/bd-p/MAS90AND200BOI

    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

(OP)
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  http://parallel.tzo.com
 

RE: MAS BOI and ASP.NET

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.

RE: MAS BOI and ASP.NET

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.


 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close