jeff_malin Absent Member.
Absent Member.

Re: Access to system table in notification context?


Hi James - Sorry I would have told you about the Authorization header but I thought you said you needed to use a Cookie - the Authorization was how my old example worked from several months ago. strRequest should not need to have the URL in it, in fact I'm surprised that that's working. You also don't need to set the user-agent string.
This is the code I have working in production:
option explicit
dim strURL, strRequest, oHTTP
set oHTTP = CreateObject("MSXML2.ServerXMLHTTP")
strRequest = "scriptname=my_script_name"
strURL = "https://myserver.mydomain.com/tmtrack..."
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 "Authorization", "Basic XXXXXXXXXXXXXXXXXXXX" 'base64 encoded user:pass
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("c:\Program Files\Serena\SBM\Application Engine\Log\myprocess.log", ForAppending, True)
filetxt.WriteLine(now & ": " & msg)
filetxt.Close
end function
0 Likes
James Butler
New Member.

Re: Access to system table in notification context?


I do need to set the User-Agent string in our environment. On the server they have javascript code that redirects non browers to a mobile site, so I made my script state it is a browser.

For some reason your code did not work on my environment so I guess others will have to experiment like I did. Thanks for all the help though, it was indeed helpful.
0 Likes
agaber Absent Member.
Absent Member.

Re: Access to system table in notification context?


Hi Jeff,

This is great! But I think I'm missing something. I'm getting "Access is denied due to invalid credentials." ...I'm guessing it's because we're using NT Challenge Response, but I haven't been able to figure out how to modify the script accordingly.

I also have "Accept info from Form/URL/Cookie" and "Accept info from Browser/Header" enabled.

Could you please point me in the right direction? Any tips would be greatly appreciated!

Thanks,

Aaron
0 Likes
jeff_malin Absent Member.
Absent Member.

Re: Access to system table in notification context?


Hi Aaron - do you have your IIS website configured to allow Basic authentication as a second method along with Integrated Auth? That's a prerequisite to being able to use the Header-based authentication method in the script above.

Note that it will warn you that this is a security hole - that's because these credentials are passing the PW in unencrypted format (Base64 is an encoding, not encryption). If you are allowing insecure (HTTP) access to SBM, this is not something that you want to enable. But if you can require SSL (HTTPS) connections to SBM, you should be OK as the headers will be encrypted for transmission anyway.

Also note that if you are using SSL with a self-signed cert, you may need to add the following directive after you create the oHTTP object:

call oHTTP.setOption(2, 13056) ' Ignore all SSL Cert issues
0 Likes
agaber Absent Member.
Absent Member.

Re: Access to system table in notification context?


Perfect, it works! Thanks!! This is going to help us a lot.
0 Likes
jeff_malin Absent Member.
Absent Member.

Re: Access to system table in notification context?


Cool, glad you were able to get it going! You should also let Support know if you think it would be a good enhancement to be able to run scripts/webservices/etc on a scheduled basis without going this 'custom' route, they are always taking feedback for incorporation into the next version(s) of SBM.
0 Likes
agaber Absent Member.
Absent Member.

Re: Access to system table in notification context?


Good point! Will do.
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.