Hello, Troy. I like the idea to have a router for files. Would the operations each have one specific directory that the router can route files to? How will the router determine the destination for each file?
- Log in to post comments
Hello, Troy. I like the idea to have a router for files. Would the operations each have one specific directory that the router can route files to? How will the router determine the destination for each file?
I realize that my HTML contains references to css files. I do not yet have the css files where pandoc is running.
Maybe I have not installed enough for pandoc to work properly in my container. Are there other tools for programmatically creating pdf (from html)?
The first file I tried to convert to PDF displays at the source system, but it does not look exactly as expected. I copy ther pdf to csp directory and display it there. I also tried a simple html file and it works correctly end-2-end.
I have seen files transferred inside JSON and I want to try it here. Before (now) I have this code to generate response object:
Set context.Response = ""
If 1=request.%IsA("EnsLib.HTTP.GenericMessage") {
If (context.StatusLine = "") {
Set context.StatusLine = "HTTP/1.1 200 OK"
}
If (##class(%File).Exists(context.Outputfile)) {
Set tStream = ##class(%Stream.FileBinary).%New()
Set tSC = tStream.LinkToFile(context.Outputfile)
If $$$ISERR(tSC) Do ##class(Oliver.Util).DebugStatus(tSC)
}
//Set tSC = tmp.%Save()
Set context.Response=##class(EnsLib.HTTP.GenericMessage).%New($Get(tStream),,request.HTTPHeaders)
Do context.Response.HTTPHeaders.SetAt("application/pdf","Content-Type")
Do context.Response.HTTPHeaders.SetAt(context.StatusLine,"StatusLine")
Set tSC = context.Response.%Save()
}
I confirmed the file is readable and displays correctly.
Does your task run as %SYSTEM?
Can you check the status returned by Prepare and Execute methods?
I wonder if this is a permission issue.
I did a search for STRINGSTACK. Then I was able to solve this issue by changing Write param.%ToJSON() to Do param.%ToJSON()
This is in Docs for %ToJSON():
method %ToJSON(outstrm As %Stream.Object) as %String
Convert a %DynamicAbstractObject into a JSON string.
outstrm is optional. There are a number of possibilities:
(1) Parameter outstrm is not defined and the method is called via 'DO'. In this case the JSON string is written to the current output device.
(2) Parameter outstrm is not defined and the method is called as an expression. In this case the JSON string becomes the value of the expression.
(3) Parameter outstrm is defined. If it is %Stream object then the JSON string will be written to the stream. If outstrm is present but not an object then it is presumed to be a fully qualified file specification. In that case, a %Stream.FileCharacter stream is created, linked to that file and the JSON string is written to that stream. On completion, this stream is saved. The full path to the file must be defined. If outstrm is an object but is not an instance of %Stream.Object then an exception will be thrown.
Thank you for clarifying the double encoding I was doing.
I just tested my code with a HTML document. Will it work with %Stream.FileBinary?
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/attachme…", 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
}
Why do you say the stream is typically a binary stream?
This is the method where I get the Stream:
ClassMethod GetStream(pFile As %String = "/tmp/shortObjectFile.txt") As %Stream.Object
{
Set pStream = ##class(%Stream.FileCharacter).%New()
Set pStream.Filename = pFile
Quit pStream
}
The code to produce the encoded file will be in my next response.
Enrico, thank you very much for your help!
I use this line of code to get a base64 encoded Stream:
Set pStream = ..lookFile(value)
I use this line to set the stream into the dynamic object:
Do obj.%Set("data",pStream,"stream>base64")
IRIS for Windows (x86-64) 2022.3 (Build 606U) Mon Jan 30 2023 09:08:55 EST
It works when I use the filename
Thank you, Julius for the example.
I replaced set newObject = {}.%FromJSONFile(file) in my code with set newObject = {}.%FromJSON(file) to get rid of the error.
Thank you, Julius. I will give it a try...
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 would like to help, but I do not understand what is the data or how the data is created. Can you share sample data or the code that creates / updates the data?
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.
Try {
Kill array
Do ##class(%SYS.Namespace).ListAll(.array)
Set ns = ""
For {
Set ns = $Order(array(ns))
If (ns = "") Quit
Kill x
Set x = $$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
I just tried in my local IRIS using Postman:
http://localhost:52773/api/mgmnt/v2/user/myapp
I got 201 response and I see classes in Package myapp in USER namespace.
When I try the request with invalid JSON body, I got 404 Not Found response.
Hello,
I just completed the survey about the interactive InterSystems IRIS Digital Health Interoperability Instruqt Course. I am also missing bonus points for Video and Second Article for iris-hl7. Thank you for your attention :-)
Management Portal > System > Globals > View Global Data
^EnsHL7.Segment
I appreciate the responses from Alexander Koblov. I wonder if @Bob Kuszewski could provide suggestion how is it possible to add mirror member outside of Kubernetes cluster.
Hi Anssi! Do you have a code sample how this can be done?
You may or may not see it in Event Log based on what is in ^Ens.Debug global.
My concern is that IKO deploys failover members with cluster local network addresses. Can an async that is located outside of the Kubernetes cluster be added to the mirror configured by IKO?
Phil, would you be able to share your transform?
Characters like \ and CR LF must be escaped.
In BPL I assign myVariable = request.RawContent
Conversion to JSON was successful with this:
Set data={}
Set data.value=myVariable
Set x=data.%ToJSON()
Hello, Logan. Do you still need help with this?
I think you need more quotes for "proper" JSON
ineaConComasAlFinal: iris_cpu_pct{id='AUXWD'}": 0,iris_cpu_pct{id='CSPSRV'}": 0,
proper JSON is
{
"iris_cpu_pct{id='AUXWD'}": 0,"iris_cpu_pct{id='CSPSRV'}": 0,...
}