James Butler
New Member.

Re: Access to system table in notification context?


It is not working Jeff. Here is my code.



option explicit

dim strURL, strRequest, oHTTP

set oHTTP = CreateObject("MSXML2.ServerXMLHTTP")

strRequest = "scriptname=myScript"

strURL = "https://myserver/tmtrack/tmtrack.dll?"

call logMsg("Making request: " & strRequest)

oHTTP.open "GET", strUrl, false

oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

oHTTP.setRequestHeader "Content-Length", Len(strRequest)

oHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)"

oHTTP.setRequestHeader "Set-Cookie", "authentication:xxxxxxxxxxxx"

oHTTP.send strRequest

call logMsg("Request complete, output: " & oHTTP.responseText)

function logMsg(msg)

dim filesys, filetxt

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set filesys = CreateObject("Scripting.FileSystemObject")

Set filetxt = filesys.OpenTextFile("F:\Program Files\Serena\SBM\Application Engine\Log\myScript.log", ForAppending, True)

filetxt.WriteLine(now & ": " & msg)

filetxt.Close

end function

All I get back in the log is just the html for the login page.

Any suggestions?
0 Likes
James Butler
New Member.

Re: Access to system table in notification context?


Can anyone help me here?
0 Likes
jeff_malin Absent Member.
Absent Member.

Re: Access to system table in notification context?


I might not have the exact parameters for the Cookie correct. Can you use something like Firebug to sniff the authentication parameters when you connect through a normal browser? That's how I figured this out originally, but we're using NT Challenge-Response now so I can't re-test this for you.
0 Likes
mobermaier Absent Member.
Absent Member.

Re: Access to system table in notification context?


When I try to execute a script directly from url I use http://myserver/tmtrack/tmtrack.dll?s, Don't see the "scriptpage" in your request.
0 Likes
James Butler
New Member.

Re: Access to system table in notification context?


Thanks Jeff I'll try firebug. I have it on my chrome browser.

Michael, it doesn't work with or without the ScriptPage identifier.

Will keep you all posted on my progress.....
0 Likes
James Butler
New Member.

Re: Access to system table in notification context?


Ok Jeff, firebug says that the cookie variable is not set-cookie but ttAuth. So I set that in the header but it still doesn't work.
0 Likes
jeff_malin Absent Member.
Absent Member.

Re: Access to system table in notification context?


I think set-cookie is used initially, to set the ttauth parameter. Have you tried sending set-cookie as the parameter name and ttauth:(encrypted string) as the parameter?
0 Likes
James Butler
New Member.

Re: Access to system table in notification context?


Yes, tried that and all I get back in the log is the html for the login page. It is not authenticating.
0 Likes
jeff_malin Absent Member.
Absent Member.

Re: Access to system table in notification context?


Do you have the accept cookie authentication turned on in the Administrator?
0 Likes
James Butler
New Member.

Re: Access to system table in notification context?


Yes, we have Accept info from Form/URL/Cookie, and Accept info from Browser/Header. Using internal passwords.

Does the user being used in this script need to have API/Script access or just a regular user?

I have tried both and still won't authenticate.
0 Likes
James Butler
New Member.

Re: Access to system table in notification context?


I have tried every conceiveable combination of all the examples you gave me Jeff and some I found on the net and still can't get this to work.

I did see where there is a bug in MSXML2.ServerXMLHTTP where the cookie is getting dropped after it goes to the server and to use either MSXML2.ServerXMLHTTP3.0 or MSXML2.ServerXMLHTTP4.0.

Niether of which is on our servers! Go figure! Maybe that is the problem since I used the getResponseHeader("Set-Cookie") and getResponseHeader("Cookie") and did not get anything for both after the request was sent.

Anyone else have some ideas?
0 Likes
James Butler
New Member.

Re: Access to system table in notification context?


Eureka!!!!

Here is the working code in case anyone else needs to do this:



option explicit

dim strURL, strRequest, oHTTP

set oHTTP = CreateObject("MSXML2.ServerXMLHTTP")

strRequest = "https://yourserver/tmtrack/tmtrack.dll?ScriptPage&scriptname=yourscriptname"

strURL = "https://yourserver/tmtrack/tmtrack.dll?ScriptPage&scriptname=yourscriptname"

call logMsg("Making request: " & strRequest)

oHTTP.open "POST", strUrl, false

oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

oHTTP.setRequestHeader "Content-Length", Len(strRequest)

oHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"

oHTTP.setRequestHeader "Authorization", "Basic xxxxxxxxxxxxxxxxxx" ' base64 encoded user:pass

oHTTP.send strRequest

call logMsg("Request complete, output: " & oHTTP.responseText & " " & oHTTP.getAllResponseHeaders() & " " & oHTTP.statusText)

function logMsg(msg)

dim filesys, filetxt

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set filesys = CreateObject("Scripting.FileSystemObject")

Set filetxt = filesys.OpenTextFile("yourdriveletter:\Program Files\Serena\SBM\Application Engine\Log\yourlogfilename.log", ForAppending, True)

filetxt.WriteLine(now & ": " & msg)

filetxt.Close

end function

set oHTTP = nothing



I just kept at it and used different url strings in strURL and strRequest. Then it dawned on me, I haven't tried the same string in both, viola! That worked.

I noticed that in the code above it does not display the whole URL so here it is:



https : //yourserver/tmtrack/tmtrack.dll?ScriptPage&scriptname=yourscriptname



I had to put the space after https and the colon so it would make it a link so you could see the whole string.

I hate forum posting!!
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.