Home > Class Reference > ENSLIB namespace > %Net.RemoteConnection
Private  Storage   

%Net.RemoteConnection


class %Net.RemoteConnection extends
%RegisteredObject

This class is DEPRECATED. It is provided only for supporting existing applications. New applications should use Web services for communication.

This class depends on C and C++ binding, so C++ binding must be installed on the server that uses this class.

	s rc=##class(%Net.RemoteConnection).%New()
	Set Status=rc.Connect("127.0.0.1","SAMPLES",1972,"_system","SYS") break:'Status
	Set Status=rc.OpenObjectId("Sample.Person",1,.per) break:'Status
	Set Status=rc.GetProperty(per,"Name",.value) break:'Status
	write value
	Set Status=rc.ResetArguments() break:'Status
	Set Status=rc.SetProperty(per,"Name","Jones,Tom "_$r(100),4) break:'Status  // 4 = $$$cbindStringId
	Set Status=rc.ResetArguments() break:'Status
	Set Status=rc.GetProperty(per,"Name",.value) break:'Status
	write value
	Set Status=rc.ResetArguments() break:'Status
	Set Status=rc.AddArgument(150,0) break:'Status  // Add 150+10
	Set Status=rc.AddArgument(10,0) break:'Status  // Add 150+10
	Set Status=rc.InvokeInstanceMethod(per, "Addition", .AdditionValue, 1) break:'Status
	Write AdditionValue
	Set Status=rc.ResetArguments() break:'Status
	Set Status=rc.InstantiateQuery(.rs,"Sample.Person","ByName")

Inventory


Parameters Properties Methods Queries Indices ForeignKeys Triggers
5 21


Summary


Properties
Connection DLL Database LastErrorCode
LastErrorString

Methods
%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OriginalNamespace %PackageName
%RemoveFromSaveSet %SerializeObject %SetModified %ValidateObject
AddArgument CheckErrorCode CloseObject Connect
CreateInstance Disconnect ExecuteQuery FetchQueryRow
GetArgument GetProperty GetQueryData InstantiateQuery
InvokeClassMethod InvokeInstanceMethod OpenObject OpenObjectId
ReleaseQuery ResetArguments SetProperty UnloadDLL


Properties


• property Connection as %Binary;
• property DLL as %Binary;
• property Database as %Binary;
• property LastErrorCode as %Integer;
• property LastErrorString as %String(MAXLEN=1024,TRUNCATE=1);

Methods


• method AddArgument(Argument, ByReference As %Boolean = 0, argType As %Integer) as %Status
Add arguments before calling methods (Call Reset before adding any)
• method CheckErrorCode() as %Status
After every call you should check the Error Code
• method CloseObject(ByRef pObject) as %Status
• method Connect(sIP As %String, sNamespace As %String, sPort As %String = "1972", sUsername As %String = "", sPassword As %String = "", sClientIP As %String = "", sClientPort As %String = "") as %Status
• method CreateInstance(sClass As %String = "", ByRef pObject As %RegisteredObject = "") as %Status
• method Disconnect() as %Status
Disconnect from remote system
• method ExecuteQuery(resultSetObject As %ResultSet) as %Status
See InstantiateQuery
• method FetchQueryRow(resultSetObject As %ResultSet, ByRef AtEnd As %Boolean) as %Status
See InstantiateQuery
• method GetArgument(ByRef Argument, ArgumentNumber As %Integer) as %Status
Used to get the value of an argument that was passed by reference
• method GetProperty(object As %RegisteredObject, sPropertyName As %String, ByRef sPropertyValue As %String) as %Status
Get property of an open object (on the remote system)
• method GetQueryData(resultSetObject As %ResultSet, position As %Integer, ByRef value As %String) as %Status
See InstantiateQuery
• method InstantiateQuery(ByRef resultSetObject As %ResultSet, ClassName As %String, QueryName As %String) as %Status
Running queries Instantiate the ResultSet, Execute, Loop {Fetch Row, GetData}, Release Query
	Set rc=##class(%Net.RemoteConnection).%New()
	Set Status=rc.Connect("127.0.0.1","SAMPLES",1972,"_system","SYS") break:'Status
	Set Status=rc.InstantiateQuery(.rs,"Sample.Person","ByName") break:'Status
	Set Status=rc.ResetArguments() break:'Status
	Set Status=rc.AddArgument("A",0,4) break:'Status   /// 4 = $$$cbindStringId
	Set Status=rc.ExecuteQuery(rs) break:'Status
	For  {Set Status=rc.FetchQueryRow(rs, .AtEnd) break:'Status  Quit:AtEnd  Set Status=rc.GetQueryData(rs, 0, .value) break:'Status  Set Status=rc.GetQueryData(rs, 1, .value1) break:'Status  Write value,?10,value1,! }
	Set Status=rc.ReleaseQuery(rs) break:'Status
• method InvokeClassMethod(sClass As %String, sMethodName As %String = "", sReturnValue As %String = "", bHasReturn As %Boolean = 0, returnType As %Integer) as %Status
This method cannot return references as a result they must be passed as parameters ie you cannot call OpenId you must call the OpenObjectId below
• method InvokeInstanceMethod(pObject As %RegisteredObject = "", sMethodName As %String = "", sReturnValue As %String = "", bHasReturn As %Boolean = 0, returnType As %Integer) as %Status
This method cannot return references as a result they must be passed as parameters ie you cannot call OpenId you must call the OpenObjectId below
• method OpenObject(sClass, OID, ByRef pObject) as %Status
• method OpenObjectId(sClass, ID, ByRef pObject) as %Status
• method ReleaseQuery(resultSetObject As %ResultSet) as %Status
See InstantiateQuery
• method ResetArguments() as %Status
Used to reset the argument list, must be called before adding arguments
• method SetProperty(object As %RegisteredObject, sPropertyName As %String, sPropertyValue As %String, argType As %Integer) as %Status
Set a property on an open object (on the remote system)
• method UnloadDLL() as %Status
Unload DLL