Child pages
  • headlessclient

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
{hidden} DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING. THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE{hidden} {sub-section:description|text=}h3. Starting Headless Clients from Debug Clients in Servoy Developer When starting a Headless Client from a Debug Client in Servoy Developer, there are restrictions to which solution can be started in the Headless Client. * Prior to Servoy
Wiki Markup
Div
styledisplay:none

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

Div
iddescription

Starting Headless Clients from Debug Clients in Servoy Developer

When starting a Headless Client from a Debug Client in Servoy Developer, there are restrictions to which solution can be started in the Headless Client.

  • Prior to Servoy 6.1.1,

  • the

  • Headless

  • Client

  • would

  • always

  • start

  • with

  • the

  • Active

  • Solution,

  • regardless

  • of which

  • solution

  • would

  • be

  • specified

*
  • As

  • of

  • Servoy

  • 6.1.1

  • the

  • specified

  • solution

  • will

  • be

  • honored,

  • as

  • long

  • as

  • the

  • specified

  • solution

  • is

  • the

  • Active

  • Solution

  • or

  • a

  • solution/module

  • included

  • in

  • the

  • Active

  • Solution

By

default

the

Headless

Client

which

is

started

will

be

a

debug-able

Headless

Client.

As

there

can

be only

one

debug-able

Client

of

a

specific

type

at

the

same

time

(so

one

debug-able

Web

Client,

one

debug-able

Smart

Client

and

one

debug-able

Headless

Client),

starting

a

new

debug-able

Headless

Client

will

close

an

existent

debug-able

Headless

Client.

It's

possible

to

start

non-debug-able

Headless

Clients

using

the

Headless

Client

plugin

while

in

Servoy

Developer

by

sending

in

the

value

"

'nodebug

"

' as

the

last

value

in

the

"

solutionOpenMethodArgs

"

array

parameter.

In

this

case

it

is

also

possible

to

start

the

Headless

Client

with

a

solution/module

that

isn't

the

Active

Solution

or

one

of

it's

modules,

as

long

as

the

specified

solution

is

available

in

the

workspace

and

uses

the

same

Resources

project

as

the

Active

Solution {sub-section}\\ {table:id=|class=servoy sReturnTypes}{tr:style=height: 30px;}{th}Return Types{th}{tr}{tr}{td}{span:class=sWordList}[JSClient]{span}{td}{tr}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[JSClient]{td}{td}[#createClient]\(solutionName, username, password, solutionOpenMethodArgs) Creates a headless client on the server that will open the given solution.{td}{tr}{tbody}{tbody}{tr}{td}[JSClient]{td}{td}[#getClient]\(clientID) Gets an existing headless client for the given client uuid.{td}{tr}{tbody}{tbody}{tr}{td}[JSClient]{td}{td}[#getOrCreateClient]\(clientId, solutionname, username, password, solutionOpenMethodArgs) This will try to get a existing client by the given id if that client is already created for that specific solution; it will create a headless client on the server that will open the given solution if it didn't exists yet.{td}{tr}{tbody}{table}\\ {table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=

Solution.



HTML Table
id
classservoy sReturnTypes
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Return Types
Table Row (tr)
Table Cell (td)
Span
classsWordList
JSClient



HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
JSClient
Table Cell (td)
createClient(solutionName, username, password, solutionOpenMethodArgs)
Creates a headless client on the server that will open the given solution.
Table Row (tr)
Table Cell (td)
JSClient
Table Cell (td)
getClient(clientID)
Gets an existing headless client for the given client uuid.
Table Row (tr)
Table Cell (td)
JSClient
Table Cell (td)
getOrCreateClient(clientId, solutionname, username, password, solutionOpenMethodArgs)
This will try to get a existing client by the given id if that client is already created for that specific solution;
it will create a headless client on the server that will open the given solution if it didn't exists yet.



HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idcreateClient-String_String_String_ObjectArray
|class=node}{tr:id=name}{td}h6.createClient{td}{tr}{tr:id=sig}{td}{span:style=float: left;
Table Row (tr)
idname
Table Cell (td)

createClient

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}[
JSClient
]{span}{span:id=iets|style=float: left;
Span
stylefont-weight:
bold;
}
createClient
{span}{span:id=iets|style=float: left;}\
Span
(solutionName,
username,
password,
solutionOpenMethodArgs)
{span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:createClient-String_String_String_ObjectArray_des|trigger=button|text=}{sub-section}{sub-section:createClient-String_String_String_ObjectArray_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:createClient-String_String_String_ObjectArray_snc|trigger=button|text=}{sub-section}{sub-section:createClient-String_String_String_ObjectArray_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:createClient-String_String_String_ObjectArray_prs|trigger=button|text=}{sub-section}{sub-section:createClient-String_String_String_ObjectArray_prs|trigger=none|class=sIndent}\{[String]} solutionName \{[String]} username \{[String]} password \{[Object]\[]} solutionOpenMethodArgs {sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:createClient-String_String_String_ObjectArray_ret|trigger=button|text=}{sub-section}{sub-section:createClient-String_String_String_ObjectArray_ret|trigger=none|class=sIndent}[JSClient]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:createClient-String_String_String_ObjectArray_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:createClient-String_String_String_ObjectArray_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:createClient-String_String_String_ObjectArray_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:createClient-String_String_String_ObjectArray_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:createClient-String_String_String_ObjectArray_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:createClient-String_String_String_ObjectArray_sam|trigger=none}{code:language=javascript}
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Creates a headless client on the server that will open the given solution.
The clientId of this client can be stored in the database to be shared between clients so that that specific client can be used
over multiply clients later on or picked up later on by this client. (Even after restart of this client)

NOTE: in the developer this will only load the solution in debug mode when it is the current active solution or a module of the active solution;
you can load any solution from the workspace when you pass "nodebug" as last argument in the arguments list (it should still use the same resources project).
But then you won't be able to debug it, breakpoints won't hit.

Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} solutionName
{String} username
{String} password
{Object[]} solutionOpenMethodArgs
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSClient
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Creates a headless client that will open the given solution.
var headlessClient = plugins.headlessclient.createClient("someSolution", "user", "pass", null);
if (headlessClient != null && headlessClient.isValid()) {

	var x = new Object();
	x.name = 'remote1';
	x.number = 10;
	headlessClient.queueMethod(null, "remoteMethod", [x], callback);
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getClient-String|class=node}{tr:id=name}{td}h6.getClient{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSClient]{span}{span:id=iets|style=float: left; font-weight: bold;}getClient{span}{span:id=iets|style=float: left;}\(clientID){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:getClient-String_des|trigger=button|text=}{sub-section}{sub-section:getClient-String_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getClient-String_snc|trigger=button|text=}{sub-section}{sub-section:getClient-String_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:getClient-String_prs|trigger=button|text=}{sub-section}{sub-section:getClient-String_prs|trigger=none|class=sIndent}\{[String]} clientID {sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:getClient-String_ret|trigger=button|text=}{sub-section}{sub-section:getClient-String_ret|trigger=none|class=sIndent}[JSClient]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getClient-String_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getClient-String_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getClient-String_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getClient-String_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getClient-String_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getClient-String_sam|trigger=none}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetClient-String
Table Row (tr)
idname
Table Cell (td)

getClient

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSClient
Span
stylefont-weight: bold;
getClient
Span
(clientID)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets an existing headless client for the given client uuid.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} clientID
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSClient
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Gets an existing headless client for the given client uuid.
var headlessClient = plugins.headlessclient.getClient("clientID");
if (headlessClient != null && headlessClient.isValid()) {
	 headlessClient.queueMethod(null, "someRemoteMethod", null, callback);
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetOrCreateClient-String_String_String_String_ObjectArray
|class=node}{tr:id=name}{td}h6.getOrCreateClient{td}{tr}{tr:id=sig}{td}{span:style=float: left;
Table Row (tr)
idname
Table Cell (td)

getOrCreateClient

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}[
JSClient
]{span}{span:id=iets|style=float: left;
Span
stylefont-weight:
bold;
}
getOrCreateClient
{span}{span:id=iets|style=float: left;}\
Span
(clientId,
solutionname,
username,
password,
solutionOpenMethodArgs)
{span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_des|trigger=button|text=}{sub-section}{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_snc|trigger=button|text=}{sub-section}{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_prs|trigger=button|text=}{sub-section}{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_prs|trigger=none|class=sIndent}\{[String]} clientId -- The id of the client if it already exists, or it will be the id of the client if it will be created. \{[String]} solutionname -- The solution to load \{[String]} username -- The user name that is used to login to the solution \{[String]} password -- The password for the user \{[Object]\[]} solutionOpenMethodArgs -- The arguments that will be passed to the solution open method. {sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_ret|trigger=button|text=}{sub-section}{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_ret|trigger=none|class=sIndent}[JSClient] -- An existing JSClient or the JSClient that is created.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getOrCreateClient-String_String_String_String_ObjectArray_sam|trigger=none}{code:language=javascript}
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

This will try to get a existing client by the given id if that client is already created for that specific solution;
it will create a headless client on the server that will open the given solution if it didn't exists yet.

If the client does exist but it is not loaded with that solution an exception will be thrown.

NOTE: in the developer this will only load the solution in debug mode when it is the current active solution or a module of the active solution;
you can load any solution from the workspace when you pass "nodebug" as last argument in the arguments list (it should still use the same resources project).
But then you won't be able to debug it, breakpoints won't hit.

Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} clientId - The id of the client if it already exists, or it will be the id of the client if it will be created.
{String} solutionname - The solution to load
{String} username - The user name that is used to login to the solution
{String} password - The password for the user
{Object[]} solutionOpenMethodArgs - The arguments that will be passed to the solution open method.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSClient - An existing JSClient or the JSClient that is created.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Creates a headless client that will open the given solution.
var storedSolutionSpecificID = "aaaabbbbccccc1111";
var headlessClient = plugins.headlessclient.getOrCreateClient(storedSolutionSpecificID, "someSolution", "user", "pass", null);
if (headlessClient != null && headlessClient.isValid()) {
	var x = new Object();
	x.name = 'remote1';
	x.number = 10;
	headlessClient.queueMethod(null, "remoteMethod", [x], callback);
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
Table Row (tr)
classlastDetailRow
Table Cell (td)