go to post Michael Angeleri · Feb 24, 2023 To create a SOAP service refer to this documentation Creating SOAP Web Services in IRIS. Within your Method you should be able to call a StoredProc and convert the output to the one required by the service. However it is not that simple to call a SOAP service directly from browser, please refer to this StackOverflow question to see possible solutions and limitations. I would consider exposing it as REST service. Either way the service needs to be exposed on the same domain as your webpage to avoid CORS.
go to post Michael Angeleri · Oct 13, 2022 This worked for me as well. In my case I was parsing an XML file ANSI encoded without proper header. Once the stream hit a special charachter (in my case "à") it wouldn't recognize it. I presume %XML.XPATH.Document and %XML.TextReader default to UTF-8 in this case, after converting the stream I was able to parse without issues. set cda2Stream = ##class(%Stream.FileBinary).%New() $$$ThrowOnError(cda2Stream.LinkToFile(cda2FileName)) // Converting to UTF-8 encoding as the original stream is ANSI encoded without proper header set convertedStream = ##class(%Stream.GlobalBinary).%New() while 'cda2Stream.AtEnd { $$$ThrowOnError(convertedStream.WriteLine($zconvert(cda2Stream.ReadLine(),"O","UTF8"))) } // Parsing the converted stream $$$ThrowOnError(##class(%XML.TextReader).ParseStream(convertedStream,.Textreader)) $$$ThrowOnError(##class(%XML.XPATH.Document).CreateFromStream(convertedStream,.XpathDoc)) set XpathDoc.PrefixMappings = "s urn:hl7-org:v3"
go to post Michael Angeleri · Jun 1, 2022 I think XML would be the best way, especially if you want to do it programmatically. This snippet will export your table to the specified folder ClassMethod ExportTable(table As %String, path As %String) { set class = $replace($replace(table,"_",""),"SQLUser.","User.") set sqlQuery = "select $listbuild(%Id,'"_class_"') as oid from "_table set rset = ##class(%SQL.Statement).%ExecDirect(,sqlQuery) while rset.%Next() { set elements(rset.%Get("oid"))="" } do ##class(XML.Element).Export(.elements, path_"/"table_".xml", "r") } And then you import it on the other instance with: ##class(XML.Element).Load(file,"/overwriteguid/notransaction/changecontrolskipevents") The advantage of this solution is that it uses %GUIDs as identifiers, as such you can add/edit data on your target system and it won't be overwritten when importing the file. An alternative way without having direct access to file system would be use a JDBC client with export functionality. I use DBeaver and you can right click on your query/table -> Execute -> Export from query:
go to post Michael Angeleri · Mar 9, 2022 Do you initialize your target variable as an instance of an object that has Name property? The following snippet works for me Class Custom.Test Extends %RegisteredObject { Property Name As %String; ClassMethod SQL() { set target = ##class(Custom.Test).%New() &sql(SELECT 'TestName' INTO :target.Name FROM MainFrame.EmployeeRecord) write target.Name } } Also, assuming you are running your test in console, you can issue write $zerror it will tell you which property is missing (could be related to something in the source rather than the target)