I need to automate the handling of usernames passwords, serverNames etc for use in the sending and receiving of emails, logging into SFTP servers etc etc for use within COS code
To manage external passwords we could use LastPass or any other proprietary password loggers, but I need to be able to call them as part of the automation (COS code) and occasionally visually look them up to "remind" the staff of their passwords.

any suggestions as to the best class data constructs to handle this scenario. Should the whole table be encrypted, only the passwords etc.

0 9
0 458

This code snippet sends an XML request to a server and saves the response to a file. The class method "test" runs the code:


Class objectscript.postXML
{
    classmethod test() {
        Set HTTPRequest = ##class(%Net.HttpRequest).%New()
        Set HTTPRequest.ContentType = "text/xml"
        Set HTTPRequest.NoDefaultContentCharset = 1
        Set HTTPRequest.Location = "ITOMCZ"
        Set HTTPRequest.Server = "wph.foactive.com"
        Do HTTPRequest.RemoveHeader("User-Agent")  
        Do HTTPRequest.RemoveHeader("Accept-Encoding") 
        Do HTTPRequest.RemoveHeader("Connection")
        Do HTTPRequest.SetHeader("Expect","100-continue")
     
        Set RequestXML = ##class(%Library.File).%New("c:\test.xml")
        Do RequestXML.Open("RS")
        Do HTTPRequest.EntityBody.CopyFrom(RequestXML)
        Do RequestXML.%Close()
     
        Do HTTPRequest.Post(HTTPRequest.Location)
     
        Do $System.OBJ.Dump(HTTPRequest)
        Do $System.OBJ.Dump(HTTPRequest.HttpResponse)
     
        Write HTTPRequest.HttpResponse.Data.Size
        Write HTTPRequest.ContentLength
     
        Set ResponseStream = ##class(%Stream.FileBinary).%New()
        // Second part is typically the file extension, i.e.: application/pdf -> pdf
        Set FileType = $Piece(HTTPRequest.HttpResponse.GetHeader("CONTENT-TYPE"),"/",2)
        Set ResponseStream.Filename = "C:\test."_FileType
     
        Write ResponseStream.CopyFrom(HTTPRequest.HttpResponse.Data)
     
        Write ResponseStream.%Save()
        Do ResponseStream.%Close()
    }
}

Here's a link to the code on GitHub

1 0
0 792
Question
· Jan 3, 2019
n00b questions

Hello,

I have some beginner questions as I am working through the InterSystems Cache learning path:

- Where I work, we us Cache, but we often learning about and train on MUMPS. No one really talks about or mentions MUMPS here, but my understanding is that ObjectScript is basically MUMPS plus whatever new things InterSystems put on top of it. Is that a fair assessment?

0 16
0 646

Hi -

I'm wondering if anyone has coded up a means to create an extension for a %Persistent class from a base class to a sub-class without making a ton of assumptions about the Global structure. I'm trying to create a new "extension" record that would have the same ID as the Base Class

Class BaseRecord Extends %Persistent

and

Class SubRecord Extends BaseRecord

where I would have an instance of a "BaseRecord" and I want to turn it into a "SubRecord" instance and have all of the existing references to the BaseRecord survive.

0 7
0 403