Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

RemoteWorkflowCall class: Difference between revisions

From Catglobe Wiki
Tungocman (talk | contribs)
No edit summary
Tungocman (talk | contribs)
No edit summary
Line 38: Line 38:
bool b = wfc.Call(foreignSite); print(b); // result:  true
bool b = wfc.Call(foreignSite); print(b); // result:  true
HttpRequest hr = wfc.CreateDefaultRequest(foreignSite);
HttpRequest hr = wfc.CreateDefaultRequest(foreignSite);
b = wfc.Call(hr); print(b); // result:  true
b = wfc.Call(hr); print(b); // result:  true


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


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


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


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





Revision as of 10:35, 7 November 2011

RemoteWorkflowCall class



Class to call workflows on other sites.

Constructors

  • (number 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
  • (number 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", AnyType parameter "The parameter to call the workflow with on the foreign site") - Create new request

Methods

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

Properties

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


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

Examples

CALLING WORKFLOW  (site: Heisenberg581.catglobe.com)
//==================

number foreignWorkflow_id = 158191;
string foreignSite = "coloplast.catglobe.com";

RemoteWorkflowCall wfc = new RemoteWorkflowCall(foreignWorkflow_id, "ManTest", "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, "ManTest", "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, "ManTest", "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, "ManTest", "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, "ManTest", "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: 158191  site: Coloplast.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;
    }