Replies:

The solution in simple....if you know it:

 set addressArray=netGate.new("remote.test.Address[2]")
 do addressArray.%set(0, home)
 do addressArray.%set(1, home2)  set person = netGate.new("remote.test.Person")
 do person.setAddressArray(addressArray)
 set addressArray2=person.getAddressArray()
 for i=0:1:1 {
      set addr = addressArray2.%get(i)
      !, addr.city
 }
 

In addition to %set() and %get() method for arrays there are also %setall(), %getall() methods.

Hopefully these methods will be documented sometime in the future.

Enrico

I realized the problem using "Recast", the gateway needs to be instantiated using the new gateway.

I had to fix a couple of things related to how the datatypes are casted and now it works.

However, this is not exactly what I was looking for, as mentioned my goal is to convert existing code that use the no longer documented "legacy gateway" to "new code" using the current (poorly) documented $system.external.

My goal is to move "forward" my code for current and future releases of IRIS.
Removing the need of the imported proxy classes also simplify the IRIS upgrade process.

Thank you again and enjoy your vacation!

Enrico
 

Hi Stuart,

thank you so much for your answer and effort, I feel sorry for your vacation!!

As mentioned, to keep things simple in my test instead of using my "real stuff" (somewhat more complex) I'm using the "old" test code %Net.Remote.DotNet.Test and corresponding .NET project that I have compiled with .NET Framework 4.5, this provides a simple testbed to test basic functionality.

Using the now undocumented legacy gateway the test works fine

Then, when I:

set ^%SYS("Gateway","Remote","Recast",namespace)=1

and reimport proxy classes, I can see that the generated proxy classes are different, so the "recast" had some effect.

Unfortunately running the test code....fail in the very first line:

USER>do ##class(%Net.Remote.DotNet.Test).Test(58555)
 
Errore #5023: Errore del gateway di Java: <ZJGTW>%dispatch+17^%Net.Remote.Base.1

It fails in the line (the first call to .NET class):

Set student=##class(remote.test.Student).%New(gateway,29,"976-01-6712")

So...neither this approach works...at all.

Thank you again,

Enrico

Followers:
Enrico has no followers yet.
Following:
Enrico has not followed anybody yet.
Global Masters badges:
Enrico has no Global Masters badges yet.