Hi Vitaly, thanks for your help!.

This code is great but I have a problem with strings. It seems strings are limited to a specified length. I pass JSON encoded in BASE64+gzip in the stream info and sometimes json size is soooo long. In this case the result string is not complete and is malformed. In Caché version the solutions was like this:

InterSystems.Data.CacheTypes.CacheCharacterStream stream = pasarela.STREAM;                           
mtdSignature.SetReturnType(CacheConnect, typeof(InterSystems.Data.CacheTypes.CacheCharacterStream));

pasarela.GetProperty("STREAM", mtdSignature);
InterSystems.Data.CacheTypes.CacheCharacterStream stream = ((InterSystems.Data.CacheTypes.CacheCharacterStream)((InterSystems.Data.CacheTypes.CacheObjReturnValue)(mtdSignature.ReturnValue)).Value);

byte[] arrbyte = new byte[(int)stream.Length];
byte[] arrbyte = pasarela.GetBytes("STREAM");
stream.Read(arrbyte, 0, (int)stream.Length);
aJSON = System.Text.Encoding.Unicode.GetString(arrbyte);

With this code there is no problem about Stream length. Can I convert value to []bytes??


Hi, thanks for the info!.

I've read the documentation but here is not the answer for my problem. First like is about the IRIS %Stream.GlobalCharacter side and the others are about Cache. The connection systems has changed from Caché version. I have a working solutions for caché but it is different in IRIS.

This is part of my IRIS Objectscript side:

Class D.DPasarela Extends %Library.RegisteredObject

Property Value As %Numeric;

Property Title As %String;

Property Message As %String;

Property STREAM As %Stream.GlobalCharacter;

Method PostMsg(SessionId As %String, Msg As %String, STREAMin As %Stream.GlobalCharacter, ByRef STREAMout As %Stream.GlobalCharacter)


As you can see I have a ClassMethod  with some params. One of these is a reference to a %Stream.GlobalCharacter and there is a param in the class with this type.

In .NET side:


IRISConnect.ConnectionString = "Server = " + ServerForm.aGlobalVars.data.CacheIP + "; "
                  + "Port = " + ServerForm.aGlobalVars.data.CachePort + "; " + "Namespace = " + ServerForm.aGlobalVars.data.NameSpace + "; "
                  + "Password = " + ServerForm.aGlobalVars.data.CachePass + "; " + "User ID = " + ServerForm.aGlobalVars.data.CacheUser + "; ";

IRIS iris = IRIS.CreateIRIS(IRISConnect);

IRISObject pasarela = (IRISObject)iris.ClassMethodObject("D.DPasarela", "%New");

byte[] bytesS = null; // In real world this is a BASE64 encoded JSON

IRISReference cacheStreamOUT = new IRISReference(null); // IS NOT CORRECT
pasarela.InvokeVoid("PostMsg",aSession, aMsg, bytesS, cacheStreamOUT);
int aValue = Convert.ToInt32(pasarela.GetLong("Value")); // OK!
string aTitle = pasarela.GetString("Title"); // OK!
string aMessage = pasarela.GetString("Message"); // OK!

aJSON = pasarela.GetBytes("STREAM"); // ERROR


In Cache client for .NET there was some utilities to manage CharacterStreams but it is not available in IRIS client for .NET. Is there any solution for this?-