go to post Enrico Parisi · Dec 7, 2023 I don't think you can implement it in a messaging routing rule. Personally I would implement it using code, writing a Business Process class. Another option is using a BPL business process, but I'm not a fan of BPL. But probably that's just me. 😊 Enrico
go to post Enrico Parisi · Dec 7, 2023 I think to remember (I might be wrong) that Service Unavailable error can be caused by a license limit and using csp pages/application can consume license slots quickly due to the sessions not being cleared and license grace period. Maybe you are using IRIS Community Edition (limited number of connections/license), if so, try to restart and see if it works right after restart. You may also check in Management Portal in System Operation -> License usage Again, I'm guessing! I might be wrong. Enrico
go to post Enrico Parisi · Dec 6, 2023 If you type in "Document.Orders.GetAt(1).ResultStatus", does it work? If not, what error do you get? Enrico P.S.: what type of rule are you using?
go to post Enrico Parisi · Dec 6, 2023 Is Document an instance of CDM.OrderResultMsg? If so, then Document.Orders.GetAt(1).ResultStatus should work, if not, what error you get? What is assigned to Document? Enrico
go to post Enrico Parisi · Dec 6, 2023 I would create my "custom" datatype extending %Library.DateTime: Class Community.dt.CustomDateTime Extends %Library.DateTime { ClassMethod LogicalToXSD(%val As %TimeStamp) As %String [ ServerOnly = 1 ] { Set %val=##class(%Library.TimeStamp).LogicalToXSD(%val) Quit $translate(%val,"TZ"," ") } ClassMethod XSDToLogical(%val As %String) As %TimeStamp [ ServerOnly = 1 ] { Set $e(%val,11)="T" Quit ##class(%Library.TimeStamp).XSDToLogical(%val) } } Then in your class define your property as: Property OPDT As Community.dt.CustomDateTime; Are you sure you really need %Library.DateTime and not %Library.TimeStamp?The difference is the JDBC/ODBC format. From the documetation: %DateTime is the same as %TimeStamp (is a sub-class or %TimeStamp) with extra logic in the DisplayToLogical and OdbcToLogical methods to handle imprecise datetime input T-SQL applications are accustomed to. If you prefer using %Library.TimeStamp, then change the superclass in my sample code. After that: USER>Set reader = ##class(%XML.Reader).%New() USER>Set sc=reader.OpenString("<NewClass2><OPDT>2023-11-30 11:07:02</OPDT></NewClass2>") USER>Do reader.CorrelateRoot("Samples.NewClass2") USER>Do reader.Next(.ReturnObject,.sc) USER>Do ReturnObject.XMLExport(,",indent") <NewClass2> <OPDT>2023-11-30 11:07:02</OPDT> </NewClass2> USER>Write ReturnObject.OPDT 2023-11-30 11:07:02 USER> Enrico
go to post Enrico Parisi · Dec 5, 2023 You have setup your REST Web application "Allowed Authentication Method" as "Unauthenticated", therefore your REST code/application runs under the "UnknownUser" account/user. My guess is that the UnknownUser user does not have enough privilege (Role(s)) to run your code.If this is just a private, isolated test system, try adding %All role to the UnknownUser user account. Enrico
go to post Enrico Parisi · Dec 5, 2023 "CALL returns an empty result" How did you determine that? After that 3 lines, run this: For {Set rset=sqlResult.%NextResult() q:rset="" do rset.%Display() Write !} I get: 1 Row Affected1 Row Affected1 Row Affected1 Row Affectedname age home_cityJorge 32 TampaEnrico 29 TurinDan 25 MiamiAlexy 21 London 4 Rows(s) Affected You may want to check the documentation: Returning Multiple Result Sets Enrico
go to post Enrico Parisi · Dec 5, 2023 I didn't realized you are still using Caché 2018! 😮 Add this to the, possibly long, list of good reasons to migrate to IRIS! 😉😊 Enrico
go to post Enrico Parisi · Dec 5, 2023 What does sqlStatus contains? Write $system.Status.GetErrorText(sqlStatus) Enrico
go to post Enrico Parisi · Dec 5, 2023 BTW, this is the new (working) link to the documentation: Command History and Aliases Enrico
go to post Enrico Parisi · Dec 5, 2023 I don't have details of your project but when you say "I want to use %SYSTEM.Event to process queues" and ask "Is there a way to store the queue with their messages in a Global?" I think that what you describe is exactly what an IRIS interoperability production does. In fact, an IRIS interoperability production internally use %SYSTEM.Event to process queues and messages are indeed queued and persisted (in globals).Within an IRIS interoperability production queued messages are preserved across system restart (and crash!), in addition messages are traced, can be resent etc etc. So my question is, given your requirements, why not using an interoperability production instead of reinventing (or reimplementing) the wheel? Enrico
go to post Enrico Parisi · Dec 5, 2023 Hi Luis, how can you possibly get a <MAXSTRING> error extracting a stream from a base64 encoded property that is imported from a JSON string that is limited itself by the MAXSTRING value? In the line: set bodyJson = %request.Content.Read() You get the whole JSON into a string limited to string max size. To avoid this, you can import directly the content stream into a dynamic object: set dynamicBody = {}.%FromJSON(%request.Content) Enrico
go to post Enrico Parisi · Dec 4, 2023 Maybe you can find some useful info in this two Global Summit 2023 sessions: OAuth 2.0 Fundamentals OAuth 2.0 in Practice with InterSystems Products Enrico
go to post Enrico Parisi · Dec 4, 2023 I'm not sure this works in version 2014 but you can try: ENSDEMO>Set stream=##class(%Stream.TmpCharacter).%New()ENSDEMO>Do stream.Write("{""facility_id"":""123456789"", ""print_job_request"":""123""}")ENSDEMO>Set sc=##class(Ens.Util.JSON).JSONStreamToObject(stream,.jsonOBJ)ENSDEMO>Write jsonOBJ."facility_id"123456789 Enrico
go to post Enrico Parisi · Dec 4, 2023 Your question reports: Product version: Ensemble 2018.1 My answer is for that version. Sorry, I don't have any 2014 version available and I really don't remember if/what something is available in that old version regarding JSON. For sure I can tell you that ##class(%Object).%FromJSON(pInput) makes no sense.I pretty sure that %DynamicObject was not available back then (so, no {} object). It's about time to upgrade or in fact, migrate to IRIS. 😊 Enrico
go to post Enrico Parisi · Dec 4, 2023 Are you calling %FromJSON passing a valid JSON or an invalid JSON?If you have an invalid JSON, whatever you do, it will fail. If you pass an invalid JSON, then: USER>w $zvCache for Windows (x86-64) 2018.1.2 (Build 309U) Mon Mar 4 2019 15:05:44 ESTUSER>Set stream=##class(%Stream.TmpCharacter).%New() USER>Do stream.Write("{""facility_id"":""123456789"", ""print_job_request""}")USER>Set dynOBJ={}.%FromJSON(stream)<THROW>%FromJSON+37^%Library.DynamicAbstractObject.1 *%Exception.General Parsing error 3 Line 1 Offset 48 If you pass a valid JSON: USER>w $zvCache for Windows (x86-64) 2018.1.2 (Build 309U) Mon Mar 4 2019 15:05:44 ESTUSER>Set stream=##class(%Stream.TmpCharacter).%New() USER>Do stream.Write("{""facility_id"":""123456789"", ""print_job_request"":""123""}")USER>Set dynOBJ={}.%FromJSON(stream)USER>write dynOBJ.%ToJSON(){"facility_id":"123456789","print_job_request":"123"}USER> POST or GET depends on what's your goal, what your service is supposed to do. Enrico
go to post Enrico Parisi · Dec 4, 2023 I think that to return multiple values a stored procedure should return a resultset (i.e.: method signature must contains ReturnResultsets keyword). Have a look to this post. HTH, Enrico
go to post Enrico Parisi · Dec 3, 2023 I see a few issues in your sample. First, it's no clear what' your goal, what do you need to do with the received json? Note that what is posted:{"facility_id":"123456789", "print_job_request"}is not a valid json, so whatever you do, it will fail. The ObjectToJSONStream() method "convert" an object to a JSON stream.In your case you have a json stream and.....I'm not sure what you need to do. Assuming the json is valid (and now isn't) you can load the json stream into a %Library.DynamicObject using: Set dynOBJ={}.%FromJSON(pInput) Now you can access properties like: Set ^data=dynOBJ."facility_id" ; quotes are needed because of _ To get the json string back: Set ^data(1)=dynOBJ.%ToJson() HTH, Enrico