 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
whornak
Joined: 21 Aug 2008 Posts: 10 Country: United States |
|
.Net GetJobLog Example |
|
I am having problems trying to utilize the GetJobLog method via .Net 2005 C#. Does anyone have an example or know the location of that uses this command. I have used the GetJogListEx method successfully but cannot get this to work.
Thanks in advance.
|
|
Fri Sep 04, 2009 4:23 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Which API/version are you calling? Do you see this method in the Object Browser?
|
|
Fri Sep 04, 2009 4:52 pm |
|
 |
whornak
Joined: 21 Aug 2008 Posts: 10 Country: United States |
|
.Net GetJobLog Example |
|
I am able to see it in the OLE/COM Viewer and am seeing:
24x7 Remote Control (COM) for ASP (Ver 3.0)
[/img]
|
|
Thu Sep 10, 2009 9:42 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
There are several COM interfaces using different parameters in order to support different environments.
Here is copy&paste from the COM interface manual
Standard COM, ASP, and VBScript COM interfaces:
Long GetJobLog ( String JobID, ByRef String Buffer, Boolean HTMLFormat )
JavaScript COM:
Long GetJobLog ( String JobID, Boolean HTMLFormat )
Just in case, here is the link to the COM interface manual http://www.softtreetech.com/24x7/24x7_COM.pdf for versions 3.6 and 4.2. The GetJobLog function is documented there.
|
|
Thu Sep 10, 2009 11:22 am |
|
 |
whornak
Joined: 21 Aug 2008 Posts: 10 Country: United States |
|
.Net GetJobLog Example |
|
I have scoured the documentation that I had previously and that of the link provided and still cannot find anything wrong given I have successfully used another function.
The code below, which is very different from any of the examples and the only way I was able to get the GetJobListEx to work, is basically the same for GetJobLog function accept for the parameter information and objects.
// Declare ParameterModifier array, having the first element set to true while all others, by default,
// are set to false.
ParameterModifier byRefParamMod = new ParameterModifier(1);
byRefParamMod[0] = true;
**************************************** Works Fine
// Parameter Modifier for the Job List
string sJobListString = string.Empty;
ParameterModifier[] pmArrayJobList = { byRefParamMod, new ParameterModifier(1), new ParameterModifier(1) };
// Create object containing command arguments
Object[] oJobListArgs = { sJobListString , false, "DISABLED,FOLDER_NAME,COMMAND,SCRIPT" };
// Capture the list of jobs currently configured
oRtnValue = tRemote24x7.InvokeMember("GetJobListEx", System.Reflection.BindingFlags.InvokeMethod, null, oRemote24x7, oJobListArgs, pmArrayJobList, null, null);
**************************************** Doesn't Work
// Parameter Modifier for the Job Log
string sJobLogString = string.Empty;
ParameterModifier[] pmArrayJobLog = { new ParameterModifier(1), byRefParamMod, new ParameterModifier(1) };
// Create object containing command arguments
Object[] oJobLogArgs = { "0", sJobLogString, false };
// Capture entire log
oRtnValue = tRemote24x7.InvokeMember("GetJobLog", System.Reflection.BindingFlags.InvokeMethod, null, oRemote24x7, oJobLogArgs, pmArrayJobLog, null, null);
**************************************** Error Message
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x80020009):
No method was found matching the name and argument list.
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Login.btnLogin_Click(Object sender, EventArgs e) in c:\\Inetpub\\wwwroot\\24x7asp_web\\Login.aspx.cs:line 92
|
|
Thu Sep 10, 2009 12:42 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
I found .H file with the following declarations
 |
 |
virtual long __cdecl getjoblistex (BSTR * buffer, VARIANT_BOOL htmlformat, BSTR columns) = 0;
virtual long __cdecl getjoblog (BSTR jobid, BSTR * buffer, VARIANT_BOOL htmlformat) = 0; |
So it looks like you are doing the right thing. Unless... you are instantiating some wrong version of the API or some very old version in which that method is not implemented.
Are you using interface identifier or COM class name? Try referencing "24x7 Remote Control (COM)"
|
|
Thu Sep 10, 2009 2:53 pm |
|
 |
whornak
Joined: 21 Aug 2008 Posts: 10 Country: United States |
|
|
|
I searched the registry and found the following which I was able to instantiate and get the GetJobListEx function to work but with each the GetJobLog doesn't work.
What I used was:
24x7 Remote Control
24x7 Remote Control for ASP
24x7 Remote Control for ASP.2.4
24x7 Remote Control for ASP.3.0
24x7 Remote Control.2.4
24x7 Remote Control.3.0
|
|
Fri Sep 11, 2009 1:24 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Maybe you've got an old type library file in the system search path that is obscuring a more recent version. Please search your system for files named 24X7OLE.TLB and let us know locations, sizes, and dates of these file.
|
|
Fri Sep 11, 2009 4:03 pm |
|
 |
whornak
Joined: 21 Aug 2008 Posts: 10 Country: United States |
|
|
|
Two files were found on my system which are:
1) C:\Program Files\24x7 Automation 3 -- 7kb -- 2/1/2001 1:10am
2) C:\Program Files\24x7 Scheduler 2.0 -- 7kb -- 2/1/2001 1:10am
|
|
Tue Sep 15, 2009 9:03 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
They are both too old. I assume you are running one of the more or less recent versions 3.4, 3.5 or 3.6
Let's try something simple first.
1. Please delete the one you found in from C:\Program Files\24x7 Scheduler 2.0 (I suggest to delete all files from that old folder)
2. Update the other one from here http://www.softtreetech.com/24x7/builds/24X7OLE.TLB
|
|
Tue Sep 15, 2009 10:11 am |
|
 |
whornak
Joined: 21 Aug 2008 Posts: 10 Country: United States |
|
.Net GetJobLog Example |
|
Performed the requested tasks and when running the application the results are identical.
|
|
Tue Sep 15, 2009 11:56 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Do you see in the list of of available com interfaces w24x7RC.vbRemote24x7 ?
Please save the following as a VBS script file and run it. Let us know what you get there
 |
 |
Dim Remote_24x7
Dim RC
Set Remote_24x7 = CreateObject("w24x7RC.vbRemote24x7")
If Remote_24x7 Is Nothing Then
' Handle the error ...
MsgBox "Error creating 24x7 COM object..."
End If
' Open new session
RC = Remote_24x7.OpenSession("john_doe", "password", "WinSock", "LocalHost", "1096", "", False)
If RC <> 1 Then
' Handle the error
MsgBox Remote_24x7.LastError
Else
' Get job log
Dim buffer
RC = Remote_24x7.GetJobLog("0", BUFFER, true)
' Done. Close session
RC = Remote_24x7.CloseSession()
MsgBox BUFFER
End If
' Destroy COM object and release all allocated resources
Set Remote_24x7 = Nothing |
|
|
Tue Sep 15, 2009 1:30 pm |
|
 |
whornak
Joined: 21 Aug 2008 Posts: 10 Country: United States |
|
|
|
CreateObject("w24x7RC.vbRemote24x7") ActiveX component can't create object: 'w24x7RC.vbRemote24x7' Error
|
|
Tue Sep 15, 2009 2:07 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Which version of 24x7 Scheduler are you running? What's your license type?
|
|
Tue Sep 15, 2009 5:46 pm |
|
 |
whornak
Joined: 21 Aug 2008 Posts: 10 Country: United States |
|
|
|
Automation Suite 3 - Version # is 3.4.26
Regarding the licensing I do not know but will check into it.
|
|
Mon Sep 21, 2009 2:35 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|