go to post Enrico Parisi · Dec 3, 2023 Hi Anna, the error you are getting is due to the missing (not started) Java Gateway using port 55555.You can get your sample working starting the default java gateway using the Management portal System Administration -> Configuration -> Connectivity -> External Language Servers, there you can customize the "%Java Server" and start it.Note that the default "%Java Server" uses port 53273, so if you want to use it, you need to change 55555 with 53273, or you can define and start your own Java Server using port 55555. Please note that you are using a legacy feature that should work for backward compatibility but it's no longer documented (the documentation page you have linked before editing your question is from Ensemble 2018, not IRIS).The new documented way to call external languages, including Java, is using InterSystems External Servers ($system.external) The following is a rewrite of the old version sample described in this page using the new External Server for Java that implement the same functionality. Set paramsJSON="{""origin"" : ""philadelphia"", ""destination"" : ""boston""}" ; Get the Java Gateway, if needed this will also start the gateway. ; You may need to configure Java Home from Management Portal: ; System Administration -> Configuration -> Connectivity -> External Language Servers ; there you can cofigure the "%Java Server" Set jgw=$system.external.getJavaGateway() Do jgw.addToPath("/path/to/jars/gson-2.10.1.jar") Set inputJSON=jgw.new("com.google.gson.JsonParser").parse(paramsJSON) Set jsonObject = inputJSON.getAsJsonObject() Set origin = jsonObject.get("origin").toString() Set destination = jsonObject.get("destination").toString() Set URLsource=jgw.new("java.net.URL","http://maps.googleapis.com/maps/api/directions/json?origin="_origin_"&destination="_destination_"&sensor=false") Set in=jgw.new("java.io.BufferedReader",jgw.new("java.io.InputStreamReader",URLsource.openStream(),"UTF-8")) Set outputJSON=jgw.new("com.google.gson.JsonParser").parse(in) Do in.close() Set jsonObject = outputJSON.getAsJsonObject() Set response = jsonObject.toString() ; just for testing write the output to terminal Write response Please note that this sample does not require any Java side code, just the libraries/jars used in the sample.For complex Java code a Java side wrapper class (or classes) can be developed to simplify the IRIS/Java interface. HTHEnrico
go to post Enrico Parisi · Dec 1, 2023 I'm afraid you cannot use the syntax shortcut () within a StrReplace function.You can use the () syntax to assign a constant string to ALL the repeating fields, like: <assign value='"PDF"' property='target.{PIDgrpgrp().ORCgrp().OBXgrp().OBX:ValueType}' action='set' /> In your case you need to iterate in each of the 3 repeating segments using foreach actions, like: <foreach property='source.{PIDgrpgrp()}' key='k1' > <foreach property='source.{PIDgrpgrp(k1).ORCgrp()}' key='k2' > <foreach property='source.{PIDgrpgrp(k1).ORCgrp(k2).OBXgrp()}' key='k3' > <assign value='..ReplaceStr(source.{PIDgrpgrp(k1).ORCgrp(k2).OBXgrp(k3).OBX:ValueType},"ED","PDF")' property='target.{PIDgrpgrp(k1).ORCgrp(k2).OBXgrp(k3).OBX:ValueType}' action='set' /> </foreach> </foreach> </foreach> Enrico
go to post Enrico Parisi · Dec 1, 2023 Hi Ian, I guess in the copy/paste something went wrong 😉Same code with different formatting: ClassMethod ValidNHS(pNHS As %String = "", Output pFailReason) As %Boolean { IF pNHS'?10N { set pFailReason = "Num" Quit 0 } set nCheckdigit = $Extract(pNHS,10,10) set nChi9Digits = $Extract(pNHS,1,9) set nMultFact = 2 set nCalcCheckdigit = 0 for i = 9 : -1 : 1 { set nThisDigit = $Extract(nChi9Digits,i,i) set nCalcCheckdigit = nCalcCheckdigit + (nThisDigit * nMultFact) set nMultFact = nMultFact + 1 } set nCalcCheckdigit = (nCalcCheckdigit # 11) set nCalcCheckdigit = 11 - nCalcCheckdigit if (nCalcCheckdigit = 10) { set pFailReason = "ChkDig" Quit 0 } if (nCalcCheckdigit = 11) { set nCalcCheckdigit = 0 } if (nCheckdigit = nCalcCheckdigit) { set pFailReason = "" Quit 1 } Else { set pFailReason = "ChkDig match" Quit 0 } }
go to post Enrico Parisi · Dec 1, 2023 I'm not sure you can "revoke start transaction" in some form, but the risk is that if the transaction start fail the tool will exit/fail the entire query. Do you know by chance what tool is used?Is it using JDBC or ODBC? Enrico
go to post Enrico Parisi · Dec 1, 2023 Hi Rochdi, you provide very few details about you environment, some can be guessed. You talk about using a services in a production and error 404, so I guess you have a business service using a SOAP inbound adapter or an HTTP inbound adapter and using a local port instead of the web server (Standard request is not enabled). Since you do get a response (404 error is a response) when using that specific port, then the server is responding and your service works correctly with a different port, then a possibility is that that port you want to use is altready used by another HTTP/SOAP service.If so, then when your business service starts you can check the Event Log and you probably find an error rhat th port cannot be opened.You can also check that if you don't start your business service you still get 404 error. But...this are only guesses, please provide more details. Enrico
go to post Enrico Parisi · Nov 30, 2023 Check the Filename setting in your Business Operation: Enrico
go to post Enrico Parisi · Nov 30, 2023 I tried to join 10 minutes before the start (20 minuts ago) but it's no longer possible: Ooops! Sorry friend, looks like this challenge is no longer available. Enrico
go to post Enrico Parisi · Nov 30, 2023 They are both possible solutions, however if you create a custom datatype you can then use it in any other property and class, without the need to implement <PropertyName>LogicalToXSD() for each property in each class. Enrico
go to post Enrico Parisi · Nov 30, 2023 I think you should contact InterSystems WRC, send a mail with all details to: support@intersystems.com Enrico
go to post Enrico Parisi · Nov 30, 2023 I would create my "custom" datatype extending %Library.DateTime: Class Community.dt.CustomDateTime Extends %Library.DateTime { /// Converts the %TimeStamp value to the canonical SOAP encoded value. ClassMethod LogicalToXSD(%val As %TimeStamp) As %String [ ServerOnly = 1 ] { Set %val=##class(%Library.TimeStamp).LogicalToXSD(%val) Quit $translate(%val,"TZ"," ") } } 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. If you prefer using %Library.TimeStamp, then change the superclass in my sample code. Enrico
go to post Enrico Parisi · Nov 30, 2023 Hi Nicki, that's EXACTLY the point of the two different calls Sync/Async (the second option commented) in my sample. If you need to wait for the task to finish (whatever it takes, maybe longer that call interval), then use SendRequestSync() call. Using SendRequestSync() if task takes longer than time interval then when it finishes the call is performed immediately because time interval has already expired. If you need to call the task on every call interval, regardless the previous call has finished, then use SendRequestAsync() call. Enrico
go to post Enrico Parisi · Nov 30, 2023 "this" in my post is a link to the page: https://community.intersystems.com/post/zen-pages-how-update-table-pane-... Enrico
go to post Enrico Parisi · Nov 29, 2023 Where does that code comes from? It seems that your method expect a %Status as returned value, try with: Quit tSC Like you did in your first example. Enrico
go to post Enrico Parisi · Nov 29, 2023 Hi Emil,I can think of 3 possible approaches. 1) Use XPATH2) Modify the XML Document as a DOM3) Use XSLT transformations All 3 can be used/implemented in IRIS. Enrico P.S.: I suggest using the latest version of the documentation
go to post Enrico Parisi · Nov 28, 2023 Hi Michael, in order for %JSONImport() method to work properly the class of "pResponse" (inheriting from %JSON.Adaptor) MUST match the structure of the JSON being imported. From the error it seems this is not the case for your class and JSON. Another option is to load/import the JSON stream into a dynamic object {} (%Library.DynamicObject) and then "manually" set your pResponse properties from the dynamic object properties. Enrico
go to post Enrico Parisi · Nov 28, 2023 Maybe the %JSONImport method is returning an error? To find it out change this two lines:do pResponse.%JSONImport(tHttpResponse.Data.Read())quit $$$OK With:quit pResponse.%JSONImport(tHttpResponse.Data.Read()) Then check the trace/event log. Enrico
go to post Enrico Parisi · Nov 28, 2023 Hi Summer, thank you for the information, since then I solved my issue and have used %setall()/getall() "magic" (secret? 😉 ) methods in a couple of cases (like streams), although I'm not sure I discovered all the magic! The real issue is the lack of documentation and samples, for me as well as for all the community. In addition, InterSystems use (used?) to say that what is not documented is considered not (officially) supported.... Enrico
go to post Enrico Parisi · Nov 27, 2023 If it's in the table, then can be viewed in the event log. All that page does is run a query against ENS_UTIL.LOG and display the result.From your screenshot the source config item should be ....RsltRouter, if not found in the list (I don't know why), you can just type it or omit it.
go to post Enrico Parisi · Nov 27, 2023 You can also search directly in the event log from the Management Portal There you also get a link to the session trace. Enrico
go to post Enrico Parisi · Nov 27, 2023 Method OnRequest(pRequest As Ens.StreamContainer, Output pResponse As Ens.Response) As %Status { $$$LOGINFO("Inne i XmlFilterProcess") set filename = pRequest.OutputFilename set stream = pRequest.Stream $$$LOGINFO(stream.Read()) set status=##class(%XML.XPATH.Document).CreateFromStream(stream,.mydoc) set status=mydoc.EvaluateExpression("/staff/doc/name","text()",.myresults) set count = myresults.Count() $$$LOGINFO(count) for i =1:1:count { set result = myresults.GetAt(i).Value $$$LOGINFO(result) } Quit status } You need to change this two lines: set status=mydoc.EvaluateExpression("/staff/doc/name","1",.myresults)set status=mydoc.EvaluateExpression("/staff/doc/name","text()",.myresults) set result = myresults.GetAt(i)set result = myresults.GetAt(i).Value Enrico