Here is my lookFile method which gets the stream for %Set:

ClassMethod lookFile(pFile As %String = "https://jira.devops.myserver.com/my-jira/plugins/servlet/raven/attachmen... 1343.docx", pFileNew As %String = "") As %Stream.Object

{

    Set q = """"

    Set tData = q_pFile_q

    Set tFileOutlog = "/ICS/jira/wlogDATA"

    Set tFileOutput = "/ICS/jira/wgetDATA1343.docx"

    Set tSC = ##class(Oliver.ZF).JiraGet(tData,tFileOutput,tFileOutlog)

    ;

    Set tEncodeFN = ..GetEncodeFilename(pFile)

    Set tEncodePath = "/ICS/jira/"

    Set pEncode = tEncodePath_tEncodeFN

    ;

    Set tEncodedFilename = ##class(Oliver.Base64).B64EncodeWordDoc(tFileOutput,pEncode)

    Set pStream = ..GetStream(pEncode)

    Quit pStream

Note: Base 64 encoding is not able to encode a string which contains unicode (2 byte) characters. If you need to Base 64 encode an unicode string, you should first translate the string to UTF8 format, then encode it. s BinaryText=$ZCONVERT(UnicodeText,"O","UTF8")
s Base64Encoded=$system.Encryption.Base64Encode(BinaryText)
Now to Decode it:
s BinaryText=$system.Encryption.Base64Decode(Base64Encoded)
s UnicodeText=$ZCONVERT(BinaryText,"I","UTF8")

I also have a Business Operation that sometimes experiences failures. My Reply Code Actions setting is E=R, my Retry Interval is 60, my Failure Timeout is -1. When a message fails, it retries after 60 seconds. This Business Operation is called from a BPL.

Connect Timeout (5) and Response Timeout (30) are the default values.

We usually do not get timeout, but we sometimes receive 500 Internal Server Error. In this case I check the response in BPL and initiate a retry. 

STOPALLPRODUCTIONS
Try {
Kill array
Do ##class(%SYS.Namespace).ListAll(.array)
Set ns = ""
For {
Set ns = $Order(array(ns))
If (ns = "") Quit
Kill x
Set = $$MyFunc(ns)
Write "x = ",x,!
}
Return
Catch {
Write $ZERROR,!
}
Quit
MyFunc(ns)
Try {
Write "ns = ",ns,!
ZN ns
Set sc1 = ##class(Ens.Director).StopProduction()
Write "sc1 = ",sc1,!
Catch {
Write $ZERROR,!
}
Return ns