Interoperability (ex. Ensemble) can be used to both import data into InterSystems Data Platforms and push it to external systems.
- Log in to post comments
Interoperability (ex. Ensemble) can be used to both import data into InterSystems Data Platforms and push it to external systems.
OnHandleCorsRequest is called automatically if a browser requests CORS.
To add to original answer a bit:
Do %response.SetHeader("Access-Control-Allow-Origin","*")This is OK for development but for production use you need to replace * with a hostname of your web site.
Check this article. You'll need either HTTP Debugging proxy or Packet analyzer to debug this.
pResponse.physicianFirstNameYou probably have a mismatched brackets somewhere.
You can also try
[].%FromJSONinstead of
{}.%FromJSONYour code has a bracket at the end:
.png)
You might have erased it accidentally?
If you're sure that there's only one object in response array, replace:
Set tSC = pResponse.%JSONImport(tHttpResponse.Data.Read())with:
Set tSC = pResponse.%JSONImport({}.%FromJSON(tHttpResponse.Data).%Get(0)) It would parse your JSON stream into a dynamic JSON array (via {}.%FromJSON(tHttpResponse.Data)), get zeroth element from it (via %Get(0)), and pass it for JSON import (via pResponse.%JSONImport).
If you're sure that there's only one object in response, replace:
Set tSC = pResponse.%JSONImport(tHttpResponse.Data.Read())with:
Set tSC = pResponse.%JSONImport({}.%FromJSON(tHttpResponse.Data).%Get(0)) If you want to parse an entire array, you'll need another class:
Class CDSM.ProviderAPI.Responses Extends (%Persistent, %JSON.Adaptor) {
Property Responses As List Of CDSM.ProviderAPI.ProviderInfo;
}And in this case replace this code:
Set pResponse=##class(CDSM.ProviderAPI.Response).%New()
Set tSC = pResponse.%JSONImport(tHttpResponse.Data.Read())With:
Set pResponse=##class(CDSM.ProviderAPI.Responses).%New()
Set tSC = pResponse.%JSONImport(tHttpResponse.Data)and update the method signature too.
Why would be better or recommended to use %CSP.REST directly, instead of EnsLib.REST.Service?
To start with using %CSP.REST is the recommended way to use REST with productions.
Are there any improvements if we use %CSP.REST?
It's easier to develop, there are more examples available, you can have a combined production/non-production REST services easily.
The first, but not the last one, so still not getting the idea of having this intermediate upgrade point.
Sure, but you can start freezing on 2016.2. There's no point in freezing if you jump to latest version from pre 2016.2
Sorry, on which topic? Everyone knows that Cache/IRIS never runs on an unsupported OS.
Upgrade path between Cache/IRIS versions where OS for old and new Cache/IRIS versions must be different.
Yes, check my other reply, I get the zeroth element from the JSON array with %Get(0).
Also both [] and {} are valid JSON.
Check out GetStored and other useful auto-generated methods in this article.
I would recommend using plain %CSP.REST and calling BP/BO from it. Here's how. You'll need to replace async call with a sync one to get response back, but the rest of the logic would be the same.
Cache 2015 is a very old release. You should update to a latest version at least, preferably to InterSystems IRIS.
upgrade to 2016.2
What is the reason of this step?
This is a first version with Frozen Plans. If this feature is not needed then upgrade to 2018.1 directly (provided OS compatibility - you're absolutely right about it).
Cache 2017.2 (our App's supported version) turned to be incompatible with Ubuntu 18, which was chosen as on OS for IRIS.
What's the official way to upgrade in that case? I usually just power down an instance, remove it from autostart, upgrade OS to the version supported by a new release, upgrade instance to a new version.
This way Cache/IRIS never runs on unsupported OS. Do you have a case with WRC on this topic?
Yeah I've merged intersystemscommunity org into intersystemsdc recently.
Great to see it used!
Another minor thing:
.png)
RESTForms2 link links to localhost and /restforms2-ui/index.html#/
Demo does not work rn
.png)
I would also recommend rewriting this property:
Property "cdsm_Physician_Issue_ID" As %String;like this:
Property physicianIssueID As %String(%JSONFIELDNAME = "cdsm_Physician_Issue_ID");This way JSON would still be imported, but you would be able to refer to property name without double quotes.
Get 0th array element from your array:
Class test.Provider Extends (%RegisteredObject, %JSON.Adaptor)
{
Property physicianFirstName As %String;
Property physicianLastName As %String;
Property physicianMiddleNameInitial As %String;
Property physicianSpecialty As %String;
Property physicianNPI As %String;
Property physicianMPIN As %String;
Property physicianTaxID As %String;
Property physicianADRId As %String;
Property physicianAddressLine1 As %String;
Property physicianCity As %String;
Property physicianState As %String;
Property physicianZip As %String;
Property physicianZipPlus4 As %String;
Property physicianPhone As %String;
Property facilityNPI As %String;
Property facilityAddressLine1 As %String;
Property facilityCity As %String;
Property facilityState As %String;
Property facilityZip As %String;
Property error As %String(MAXLEN = 200);
Property "cdsm_Physician_Issue_ID" As %String;
ClassMethod GetJSON() [ CodeMode = expression ]
{
[
{
"physicianFirstName": "STEVENSON",
"physicianLastName": "HOWARD",
"physicianMiddleNameInitial": "W",
"physicianSpecialty": "null",
"physicianNPI": "null",
"physicianMPIN": "null",
"physicianTaxID": "null",
"physicianADRId": "null",
"physicianAddressLine1": "null",
"physicianCity": "null",
"physicianState": "null",
"physicianZip": "null",
"physicianZipPlus4": "null",
"physicianPhone": "null",
"facilityNPI": "null",
"facilityAddressLine1": "\"\"",
"facilityCity": "\"\"",
"facilityState": "\"\"",
"facilityZip": "\"\"",
"error": "Invalid NPI. Requested NPI should contain 10 numeric digits",
"cdsm_Physician_Issue_ID": "null"
}
]
}
/// do ##class(test.Provider).Test()
ClassMethod Test()
{
set json = ..GetJSON()
set obj = ..%New()
set sc = obj.%JSONImport(json.%Get(0))
zw sc,obj
}
}InterSystems provides a specialized Spark connector. Documentation. And, of course, you can use a JDBC driver.
As for Kafka here's some examples showing InterSystems IRIS<>Kafka interoperability:
%ZEN.Auxiliary.jsonProvider class and %ConvertJSONToObject method are definitely available in 2018.1. They are available on way older versions - 2014.1 at least and probably older.
That said, in 2018.1 it would be better to use %ZEN.Auxiliary.altJSONProvider - it has the same methods but uses dynamic objects instead of %ZEN.proxyObject which is faster.
Vadim Fedorov wrote you an email with details.
Interesting.
Also check out the Fraud Prevention Demo by @Amir.Samary.
First of all I would recommend reading these two documents available on WRC (Software Distribution - Docs):
First one explains the differences between Cache and InterSystems IRIS and the second one is about automated in-place conversion from Cache to InterSystems IRIS.
I would recommend the following steps:
Can you please provide an example?
And the error you're getting.
The comments talk about modifying a setting too.
In general you need to open a corresponding Ens.Config.Item, adjust settings properties and save it. And activate changes in production of course.