VBScript/COM and OneWorld

b_gilmore

Well Known Member
Does anyone have any successful experience with calling a OneWorld BSFN thru
COM by way of a VBScript script?

I'm attempting to use the AddressBook VB/COM example to model a VBScript
solution that simply calls a GetDateandTime function and I'm running into a
snag.

I can instantiate the connection object and get an "accessnumber" (i.e.
Session id). I can also instatiate the object that I created by building the
wrapper (I called it JDEInterop.JDEInterop) but when I try to call the BSFN
that I have wrapped in the com object (in this case B0500420
GetCurrentDateandTime), I get the error:

C:\interop\test.vbs(38, 1) Microsoft VBScript runtime error: Type mismatch:
'objDate.GetJDEDateTime'

I've included my humble code for review, please make any recommendations if
you can or please submit a similiar example that you might have gotten
working.
Thanks.
Bruce Gilmore

***********************************************************************
'CREATE VARIABLES
Dim uid
Dim pwd
Dim Env

'SET VARIABLES FOR LOGIN METHOD
uid="JDE"
pwd="JDE"
Env="DV7333"

'CREATE CONNECTION OBJECT
Set objConn=CreateObject("OneWorld.Connector.1")

'LOGIN AND CREATE SESSION
intSessionid=objConn.Login(uid, pwd, Env)
'ECHO SESSION ID NUMBER
WScript.Echo(intSessionid)

'INSTANTIATE ONEWORLD INTERFACE OBJECT
Set OW=objConn.CreateBusinessObject("OneWorld.FunctionHelper.1",
intSessionid)

'INSTANTIATE OBJECT THAT WAS CREATED WITH GENCOM AND REGSVR32 TO CALL BSFN
Set objDate=objConn.CreateBusinessObject("JDEInterop.JDEInterop",
intSessionid)

'INSTANTIATE DSTR OBJECT THAT WAS CREATED IN THE SAME CLASS AS THE PREVIOUS
OBJECT
Set dstr=objConn.CreateBusinessObject("JDEInterop.D0500420", intSessionid)

'CALL METHOD TO GET THE PARAMETERSET
objDate.CreateGetJDEDateTimeParameterset


'CALL THE METHOD TO EXECUTE THE BSFN B0500420 GetCurrentDateandTime AS alias
GetJDEDateTime
objDate.GetJDEDateTime dstr, OW, objConn, intSessionid 'This is the line
giving the error

'VERIFY THE TYPE OF OBJECT --- OBJ = 9
WScript.Echo("OWINTERFACE" & varType(OW))
WScript.Echo("Connection object" & varType(objConn))
WScript.Echo("objDate " & varType(objDate))
WScript.Echo("dstr " & varType(dstr))

'LOGOFF SESSION
objConn.Logoff(intSessionid)

'RELEASE OBJECTS
set dstr=nothing
set OW=nothing
set objDate=nothing
set intSessionid=nothing
set objConn=nothing
 
I've got the same problem with vbs and your sample.
I wrote the following one that runs with VB6 :
Option Explicit
Dim OneWorld As New OneWorldInterface
Dim conn As New Connector
Dim Wrapper As New B0500420
Dim Dstr As New D0500420
Dim Session As Long
Sub main()
Session = conn.Login("JDE", "******", "DV7333")
Set OneWorld = conn.CreateBusinessObject("OneWorld.FunctionHelper.1", Session)
Set Wrapper = conn.CreateBusinessObject("B0500420.B0500420", Session)
Set Dstr = conn.CreateBusinessObject("B0500420.D0500420", Session)
Wrapper.CreateGetCurrentDateandTimeParameterset
Wrapper.GetCurrentDateandTime Dstr, OneWorld, conn, Session
MsgBox Dstr.szDateTime
conn.Logoff Session
Set Wrapper = Nothing
Set Dstr = Nothing
Set OneWorld = Nothing
End Sub
 
Back
Top