Difference between revisions of "RemoteWorkflowCall class"

From Catglobe Wiki
Jump to: navigation, search
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{CGscriptClass_Template
 
{{CGscriptClass_Template
|Name=<nowiki>RemoteWorkflowCall class</nowiki>
+
|Name=<nowiki>RemoteWorkflowCall</nowiki>
 
|Description=<nowiki>Class to call workflows on other sites.</nowiki>
 
|Description=<nowiki>Class to call workflows on other sites.</nowiki>
|Constructors=
+
|InheritsFrom=object|Constructors=
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptConstructors_Template|Parameters=
{{CGscriptParameters_Template|Type=number|Name=<nowiki>resourceId</nowiki>|Description=<nowiki>The resource id of the script to call on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>username</nowiki>|Description=<nowiki>The username on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>password</nowiki>|Description=<nowiki>The password on the foreign site</nowiki>}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>resourceId</nowiki>|Description=<nowiki>The resource id of the script to call on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>username</nowiki>|Description=<nowiki>The username on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>password</nowiki>|Description=<nowiki>The password on the foreign site</nowiki>}}
 
|Description=<nowiki>Create new request</nowiki>}}
 
|Description=<nowiki>Create new request</nowiki>}}
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptConstructors_Template|Parameters=
{{CGscriptParameters_Template|Type=number|Name=<nowiki>resourceId</nowiki>|Description=<nowiki>The resource id of the script to call on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>username</nowiki>|Description=<nowiki>The username on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>password</nowiki>|Description=<nowiki>The password on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=AnyType|Name=<nowiki>parameter</nowiki>|Description=<nowiki>The parameter to call the workflow with on the foreign site</nowiki>}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>resourceId</nowiki>|Description=<nowiki>The resource id of the script to call on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>username</nowiki>|Description=<nowiki>The username on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>password</nowiki>|Description=<nowiki>The password on the foreign site</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>parameters</nowiki>|Description=<nowiki>The parameters to call the workflow with on the foreign site</nowiki>}}
 
|Description=<nowiki>Create new request</nowiki>}}
 
|Description=<nowiki>Create new request</nowiki>}}
 
|Methods=
 
|Methods=
{{CGscriptMethods_Template|ReturnType=AnyType|Name=<nowiki>Call</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>Call</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>site</nowiki>|Description=<nowiki>Url of the site to call. E.g. cg.catglobe.com.</nowiki>}}
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>site</nowiki>|Description=<nowiki>Url of the site to call. E.g. cg.catglobe.com.</nowiki>}}
 
|Description=<nowiki>Call the foreign site and get the result</nowiki>}}
 
|Description=<nowiki>Call the foreign site and get the result</nowiki>}}
{{CGscriptMethods_Template|ReturnType=AnyType|Name=<nowiki>Call</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>Call</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=HttpRequest|Name=<nowiki>request</nowiki>|Description=<nowiki>Call using a premade object, in case it requires special settings.</nowiki>}}
 
{{CGscriptParameters_Template|Type=HttpRequest|Name=<nowiki>request</nowiki>|Description=<nowiki>Call using a premade object, in case it requires special settings.</nowiki>}}
 
|Description=<nowiki>Call the foreign site and get the result</nowiki>}}
 
|Description=<nowiki>Call the foreign site and get the result</nowiki>}}
{{CGscriptMethods_Template|ReturnType=HttpRequest|Name=<nowiki>CreateDefaultRequest</nowiki>|Parameters=
+
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>CallWcf</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>site</nowiki>|Description=<nowiki>Url of the site to call. E.g. cg.catglobe.com.</nowiki>}}
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>site</nowiki>|Description=<nowiki>Url of the site to call. E.g. cg.catglobe.com.</nowiki>}}
|Description=<nowiki>Create a request with the default settings</nowiki>}}
+
|Description=<nowiki>OBSOLETE! Call the foreign site and get the result</nowiki>}}
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>CallWcf</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=HttpRequest|Name=<nowiki>request</nowiki>|Description=<nowiki>Call using a premade object, in case it requires special settings.</nowiki>}}
 +
|Description=<nowiki>OBSOLETE! Call the foreign site and get the result</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}}
 
|Properties=
 
|Properties=
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
}}  
+
|StaticMethods=
 +
{{CGscriptMethods_Template|ReturnType=HttpRequest|Name=<nowiki>RemoteWorkflowCall_createDefaultRequest</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=string|Name=<nowiki>site</nowiki>|Description=<nowiki>Url of the site to call. E.g. cg.catglobe.com.</nowiki>}}
 +
|Description=<nowiki>Create a request with the default settings.</nowiki>}}
 +
}}
 +
(see more at: [[RemoteWorkflowCall_createDefaultRequest]])
 +
 
  
 
'''More information about an HTTP Message:''' [http://www.jmarshall.com/easy/http/ http://www.jmarshall.com/easy/http/]<br>  
 
'''More information about an HTTP Message:''' [http://www.jmarshall.com/easy/http/ http://www.jmarshall.com/easy/http/]<br>  
Line 29: Line 38:
 
==== <span style="color:#a52a2a;">Examples</span>  ====
 
==== <span style="color:#a52a2a;">Examples</span>  ====
  
<span style="color: rgb(165, 42, 42);"><source lang="javascript"></source></span>  
+
<span style="color: rgb(165, 42, 42);"><source lang="javascript">CALLING WORKFLOW 
 +
//==================
 +
 
 +
number foreignWorkflow_id = 12222;
 +
string foreignSite = "cg.catglobe.com";
 +
 
 +
RemoteWorkflowCall wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnBoolean"});
 +
bool b = wfc.Call(foreignSite); print(b); // result:  true
 +
HttpRequest hr = wfc.CreateDefaultRequest(foreignSite);
 +
b = wfc.Call(hr); print(b); // result:  true
 +
 
 +
wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnNumber"});
 +
number n = wfc.Call(foreignSite); print(n); // result:  99999
 +
hr = wfc.CreateDefaultRequest(foreignSite);
 +
n = wfc.Call(hr); print(n); // result:  99999
 +
 
 +
wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnString"});
 +
string s = wfc.Call(foreignSite); print(s); // result:  this is string
 +
hr = wfc.CreateDefaultRequest(foreignSite);
 +
s = wfc.Call(hr); print(s); // result:  this is string
 +
 
 +
wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnArray"});
 +
array a = wfc.Call(foreignSite); print(a); // result:  {aa,11,{11,bb}}
 +
hr = wfc.CreateDefaultRequest(foreignSite);
 +
a = wfc.Call(hr); print(a); // result:  {aa,11,{11,bb}}
 +
 
 +
wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnDictionary"});
 +
Dictionary d = wfc.Call(foreignSite); print(d); // result:  {"key1": value1, "key2": 3423, "key3": {aa,32,{343,bb}}, "5": 88}
 +
hr = wfc.CreateDefaultRequest(foreignSite);
 +
d = wfc.Call(hr); print(d); // result:  {"key1": value1, "key2": 3423, "key3": {aa,32,{343,bb}}, "5": 88}
 +
 
 +
 
 +
FOREIGN WORKFLOW  (id: 12222  site cg.catglobe.com)
 +
//=========================
 +
 
 +
array parameters = Workflow_getParameters();
 +
if(parameters[0] == "returnBoolean")
 +
    return true;
 +
if(parameters[0] == "returnNumber")
 +
    return 99999;
 +
if(parameters[0] == "returnString")
 +
    return "this is string";
 +
if(parameters[0] == "returnArray")
 +
    {
 +
array a = {"aa",11,{11,"bb"}};
 +
return a;
 +
    }
 +
if(parameters[0] == "returnDictionary")
 +
    {
 +
Dictionary d = {"key1": "value1","key2": 3423,"key3": {"aa",32,{343,"bb"}},5: 88};
 +
return d;
 +
    }</source></span> __NOTOC__
  
 
[[Category:Workflow]]
 
[[Category:Workflow]]
__NOTOC__
 

Latest revision as of 08:43, 2 July 2020

RemoteWorkflowCall



Class to call workflows on other sites.

Parent class

Inherits from object

Constructors

  • (int resourceId "The resource id of the script to call on the foreign site", string username "The username on the foreign site", string password "The password on the foreign site") - Create new request
  • (int resourceId "The resource id of the script to call on the foreign site", string username "The username on the foreign site", string password "The password on the foreign site", object parameters "The parameters to call the workflow with on the foreign site") - Create new request

Methods

  • object Call(string site "Url of the site to call. E.g. cg.catglobe.com.") - Call the foreign site and get the result
  • object Call(HttpRequest request "Call using a premade object, in case it requires special settings.") - Call the foreign site and get the result
  • object CallWcf(string site "Url of the site to call. E.g. cg.catglobe.com.") - OBSOLETE! Call the foreign site and get the result
  • object CallWcf(HttpRequest request "Call using a premade object, in case it requires special settings.") - OBSOLETE! Call the foreign site and get the result
  • (From object) string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.

Static Methods

  • HttpRequest RemoteWorkflowCall_createDefaultRequest(string site "Url of the site to call. E.g. cg.catglobe.com.") - Create a request with the default settings.

(see more at: RemoteWorkflowCall_createDefaultRequest)


More information about an HTTP Message: http://www.jmarshall.com/easy/http/

Examples

CALLING WORKFLOW  
//==================

number foreignWorkflow_id = 12222;
string foreignSite = "cg.catglobe.com";

RemoteWorkflowCall wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnBoolean"});
bool b = wfc.Call(foreignSite); print(b);					// result:  true
HttpRequest hr = wfc.CreateDefaultRequest(foreignSite);
b = wfc.Call(hr); print(b);							// result:  true

wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnNumber"});
number n = wfc.Call(foreignSite); print(n);					// result:  99999
hr = wfc.CreateDefaultRequest(foreignSite);
n = wfc.Call(hr); print(n);							// result:  99999

wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnString"});
string s = wfc.Call(foreignSite); print(s);					// result:  this is string
hr = wfc.CreateDefaultRequest(foreignSite);
s = wfc.Call(hr); print(s);							// result:  this is string

wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnArray"});
array a = wfc.Call(foreignSite); print(a);					// result:  {aa,11,{11,bb}}
hr = wfc.CreateDefaultRequest(foreignSite);
a = wfc.Call(hr); print(a);							// result:  {aa,11,{11,bb}}

wfc = new RemoteWorkflowCall(foreignWorkflow_id, "TestTest", "123456", {"returnDictionary"});
Dictionary d = wfc.Call(foreignSite); print(d);				// result:  {"key1": value1, "key2": 3423, "key3": {aa,32,{343,bb}}, "5": 88}
hr = wfc.CreateDefaultRequest(foreignSite);
d = wfc.Call(hr); print(d);						// result:  {"key1": value1, "key2": 3423, "key3": {aa,32,{343,bb}}, "5": 88}


FOREIGN WORKFLOW   (id: 12222  site cg.catglobe.com)
//=========================

array parameters = Workflow_getParameters();
if(parameters[0] == "returnBoolean")
    return true;
if(parameters[0] == "returnNumber")
    return 99999;
if(parameters[0] == "returnString")
    return "this is string";
if(parameters[0] == "returnArray")
    {
	array a = {"aa",11,{11,"bb"}};
	return a;
    }
if(parameters[0] == "returnDictionary")
    {
	Dictionary d = {"key1": "value1","key2": 3423,"key3": {"aa",32,{343,"bb"}},5: 88};
	return d;
    }