Skip to main content
Version: 2025.2

net

Methods​

callRestWebservice​

callRestWebservice(pRestConfig, pAuthConfig): string

Call a Rest webservice with a configuration object for rest webservice calls.

Parameters​

pRestConfig

the rest config

pAuthConfig

the authorization config, e.g. BasicAuth/OAuth/OAuth2/NoAuth

Returns​

string

The return value of the web service.

Throws​

AditoException


callRestWebserviceBasicAuth​

callRestWebserviceBasicAuth(pURL, pActionType, pQueryParams, pRequestEntity, pHeaders, pDatatypeAccept, pDataTypeSend, pDatatypeJDitoAccept, pDatatypeJDitoSend, pUser, pPassword, pReturnExtendedResponseInfos?): string

Aufruf eines REST-Webservices: Basic Auth

Die erweiterten Rückgabeinfromationen werden im JSON Format zurückgeliefert.

Beispiel:

{

    "hasHttpSuccessStatusCode": true,

    "httpStatusCode": 204,

    "body": "",

    "header": {

        "MyHeader": ["Value1", "Value2"],

        "Server": ["Restlet-Framework/2.3.5"],

        "Content-Type": ["text/plain;charset=utf-8"]

    }

}

Parameters​

pURL
string | number | boolean

Serveradresse an den die Anfrage geschickt wird

pActionType
string | number | boolean

Art der Anfrage (GET, POST, PUT, DELETE) muss vorhanden sein

pQueryParams
any

Parameter für die Anfrage, kann auch null sein

pRequestEntity
string | number | boolean

der Inhalt des Requests, kann null sein

pHeaders
any

für die Anfrage, kann auch null sein

pDatatypeAccept
string | number | boolean

gewünschter Typ der Antwort, muss vom Server unterstützt werden, siehe MediaType (default = "text/plain"")

pDataTypeSend
string | number | boolean

der Typ der gesendeten Anfrage an den Server (default = "text/plain")

pDatatypeJDitoAccept
number

der Datentyp im ADITO für die empfangenen Daten (a.DATA_TEXT, a.DATA_BINARY)

pDatatypeJDitoSend
number

der Datentyp im ADITO für die gesendeten Daten (a.DATA_TEXT, a.DATA_BINARY)

pUser
string | number | boolean

der Benutzername

pPassword
string | number | boolean

das Passwort

pReturnExtendedResponseInfos?
boolean

True = Liefert eine JSON als Response zurück; False = Liefert den Body der Response

Returns​

string

Throws​

May throw an exception.


callRestWebserviceNoAuth​

callRestWebserviceNoAuth(pURL, pActionType, pQueryParams, pRequestEntity, pHeaders, pDatatypeAccept, pDataTypeSend, pDatatypeJDitoAccept, pDatatypeJDitoSend, pReturnExtendedResponseInfos?): string

Aufruf eines REST-Webservices: Kein Auth

Die erweiterten Rückgabeinfromationen werden im JSON Format zurückgeliefert.

Beispiel:

{

    "hasHttpSuccessStatusCode": true,

    "httpStatusCode": 204,

    "body": "",

    "header": {

        "MyHeader": ["Value1", "Value2"],

        "Server": ["Restlet-Framework/2.3.5"],

        "Content-Type": ["text/plain;charset=utf-8"]

    }

}

Parameters​

pURL
string | number | boolean

Serveradresse an den die Anfrage geschickt wird

pActionType
string | number | boolean

Art der Anfrage (GET, POST, PUT, DELETE) -> muss vorhanden sein

pQueryParams
any
pRequestEntity
string | number | boolean

der Inhalt des Requests, kann null sein

pHeaders
any

für die Anfrage, kann auch null sein

pDatatypeAccept
string | number | boolean

gewünschter Typ der Antwort, muss vom Server unterstützt werden, siehe MediaType (default = "text/plain")

pDataTypeSend
string | number | boolean

der Typ der gesendeten Anfrage an den Server (default = "text/plain")

pDatatypeJDitoAccept
number

der Datentyp im ADITO für die empfangenen Daten (a.TYPE_TEXT, a.TYPE_BINARY)

pDatatypeJDitoSend
number

der Datentyp im ADITO für die gesendeten Daten (a.TYPE_TEXT, a.TYPE_BINARY)

pReturnExtendedResponseInfos?
boolean

True = Liefert eine JSON als Response zurück; False = Liefert den Body der Response

Returns​

string

Throws​

May throw an exception.


callRestWebserviceOAuth​

callRestWebserviceOAuth(pURL, pActionType, pQueryParams, pRequestEntity, pHeaders, pDatatypeAccept, pDataTypeSend, pDatatypeJDitoAccept, pDatatypeJDitoSend, pSignatureMethod, pConsumerKey, pToken, pTimeStamp, pRealm, pNonce, pVersion, pConsumerSecret, pTokenSecret, pReturnExtendedResponseInfos?): string

Aufruf eines REST-Webservices: OAuth

Die erweiterten Rückgabeinfromationen werden im JSON Format zurückgeliefert.

Beispiel:

{

    "hasHttpSuccessStatusCode": true,

    "httpStatusCode": 204,

    "body": "",

    "header": {

        "MyHeader": ["Value1", "Value2"],

        "Server": ["Restlet-Framework/2.3.5"],

        "Content-Type": ["text/plain;charset=utf-8"]

    }

}

Parameters​

pURL
string | number | boolean

Serveradresse an den die Anfrage geschickt wird

pActionType
string | number | boolean

Art der Anfrage (GET, POST, PUT, DELETE) -> muss vorhanden sein

pQueryParams
any
pRequestEntity
string | number | boolean

der Inhalt des Requests, kann null sein

pHeaders
any

für die Anfrage, kann auch null sein

pDatatypeAccept
string | number | boolean

gewünschter Typ der Antwort, muss vom Server unterstützt werden, siehe MediaType (default = "text/plain")

pDataTypeSend
string | number | boolean

der Typ der gesendeten Anfrage an den Server (default = "text/plain")

pDatatypeJDitoAccept
number

der Datentyp im ADITO für die empfangenen Daten (a.TYPE_TEXT, a.TYPE_BINARY)

pDatatypeJDitoSend
number

der Datentyp im ADITO für die gesendeten Daten (a.TYPE_TEXT, a.TYPE_BINARY)

pSignatureMethod
string | number | boolean

Signatur-Methode z.B. HMAC-SHA1

pConsumerKey
string | number | boolean

Benutzer Schlüssel

pToken
string | number | boolean

Token

pTimeStamp
string | number | boolean

Zeitstempel (kann null sein, dann default)

pRealm
string | number | boolean

Realm (kann null sein, dann default)

pNonce
string | number | boolean

Nonce (kann null sein, dann default)

pVersion
string | number | boolean

Version (kann null sein, dann default)

pConsumerSecret
string | number | boolean

Benutzer Secret z.B. API-Key

pTokenSecret
string | number | boolean

TokenSecret

pReturnExtendedResponseInfos?
boolean

True = Liefert eine JSON als Response zurück; False = Liefert den Body der Response

Returns​

string

Throws​

May throw an exception.


callRestWebserviceOAuth2​

callRestWebserviceOAuth2(pURL, pActionType, pQueryParams, pRequestEntity, pHeaders, pDatatypeAccept, pDataTypeSend, pDatatypeJDitoAccept, pDatatypeJDitoSend, pToken, pReturnExtendedResponseInfos?): string

Aufruf eines REST-Webservices: OAuth2

Die erweiterten Rückgabeinfromationen werden im JSON Format zurückgeliefert.

Beispiel:

{

    "hasHttpSuccessStatusCode": true,

    "httpStatusCode": 204,

    "body": "",

    "header": {

        "MyHeader": ["Value1", "Value2"],

        "Server": ["Restlet-Framework/2.3.5"],

        "Content-Type": ["text/plain;charset=utf-8"]

    }

}

ACHTUNG: OAuth2 mit bereits übergebenen Token macht nichts anderes als den Token als URL-Parameter hinzuzufügen und eine NoAuth durchzuführen, WEIL: Wenn bereits ein Token existiert, ist die Authentifizierung bereits abgeschlossen und man muss lediglich einen Webservice mit dem richtigen Token aufrufen.

Parameters​

pURL
string | number | boolean

Serveradresse an den die Anfrage geschickt wird

pActionType
string | number | boolean

Art der Anfrage (GET, POST, PUT, DELETE) -> muss vorhanden sein

pQueryParams
any
pRequestEntity
string | number | boolean

der Inhalt des Requests, kann null sein

pHeaders
any

für die Anfrage, kann auch null sein

pDatatypeAccept
string | number | boolean

gewünschter Typ der Antwort, muss vom Server unterstützt werden, siehe MediaType (default = "text/plain")

pDataTypeSend
string | number | boolean

der Typ der gesendeten Anfrage an den Server (default = "text/plain")

pDatatypeJDitoAccept
number

der Datentyp im ADITO für die empfangenen Daten (a.TYPE_TEXT, a.TYPE_BINARY)

pDatatypeJDitoSend
number

der Datentyp im ADITO für die gesendeten Daten (a.TYPE_TEXT, a.TYPE_BINARY)

pToken
string | number | boolean

der Access-Token

pReturnExtendedResponseInfos?
boolean

True = Liefert eine JSON als Response zurück; False = Liefert den Body der Response

Returns​

string

Throws​

May throw an exception.


callSoapWebservice​

callSoapWebservice(pSoapConfig, pAuthConfig): any[]

Call a Soap webservice with a configuration object for Soap webservice calls.

Parameters​

pSoapConfig

the rest config

pAuthConfig

the authorization config, e.g. BasicAuth/OAuth/OAuth2/NoAuth

Returns​

any[]

Object[] [0] (Boolean) - a flag that tells if the call was successful or not [1] (String) - the response as XML String

Throws​

May throw an exception.

Throws​

AditoIllegalArgumentException

Throws​

AditoInstantiationException

Throws​

AditoIllegalStateException


callSoapWebserviceBasicAuth​

callSoapWebserviceBasicAuth(pURL, pXml, pAction, pUser, pPassword, pHeaders?, pQueryParams?): any[]

Call a SOAP webservice with BASIC authentification.

Parameters​

pURL
string | number | boolean

Server address to which the request will be sent.

pXml
string | number | boolean

the requests xml as string

pAction
string | number | boolean

the action to execute on the webservice

pUser
string | number | boolean

the user for authentification

pPassword
string | number | boolean

the password for authentification

pHeaders?
any

the request headers

pQueryParams?
any

the query parameters for the request

Returns​

any[]

Object[] [0] (Boolean) - gibt an, ob der Aufruf fehlgeschlagen(false) ist, oder ob er erfolgreich(true) war [1] (String) - Der Response im XML-Format

Throws​

May throw an exception.

Throws​

AditoInstantiationException

Throws​

AditoIllegalArgumentException


callSoapWebserviceNoAuth​

callSoapWebserviceNoAuth(pURL, pXml, pAction, pHeaders?, pQueryParams?): any[]

Call a SOAP webservice without authentification.

Parameters​

pURL
string | number | boolean

Server address to which the request will be sent.

pXml
string | number | boolean

the requests xml as string

pAction
string | number | boolean

the action to execute on the webservice

pHeaders?
any

the request headers

pQueryParams?
any

the query parameters for the request

Returns​

any[]

Object[] [0] (Boolean) - specifies if the call has failed (false), or if it was succesful (true) [1] (String) - the response in xml format

Throws​

May throw an exception.

Throws​

AditoInstantiationException

Throws​

AditoIllegalArgumentException


createConfigForRestWebserviceCall​

createConfigForRestWebserviceCall(): RestConfig

Create and return a config object for rest webservice calls.

Returns​

RestConfig


createConfigForSoapWebserviceCall​

createConfigForSoapWebserviceCall(): SoapConfig

Create and return a config object for soap webservice calls.

Returns​

SoapConfig


forBinaryFile​

forBinaryFile(name, content, contentType, filename): BinaryMultipart

Create a multipart object representing a file upload of a binary text file, not a text file. Internally this will convert the content to a byte array. Each of these objects will need a name like in an HTML form. example call:

Parameters​

name
string | number | boolean

the name of the form field for the file.

content
any

the content as a Base64 encoded String.

contentType
string | number | boolean

the content type, e.g. "application/vnd.openxmlformats-officedocument.wordprocessingml.document"

filename
string | number | boolean

the name of the file that is to be sent. this might be of importance to the target webservice.

Returns​

the config object that can later be included in the REST call configuration

Example​

var document = fileIO.getData("c:/temp/myinputfile.docx", util.DATA_BINARY, "UTF-8");
var part = netMultipart.forBinaryFile("doc", document, "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"myfilename.docx");

forTextFile​

forTextFile(name, content, contentType, filename): TextMultipart

Create a multipart object representing a text file, not a text. Each of these objects will need a name like in an HTML form. Note that this will automatically use the content type "text/plain". example call:

Parameters​

name
string | number | boolean

the name of the form field for the file or text content.

content
string | number | boolean

the content as a String.

contentType
string | number | boolean

the content type, e.g. "plain/text" (defailt value is the same)

filename
string | number | boolean

the name of the file that is to be sent. this might be of importance to the target webservice. the filename must be used for the file name. internally this is important to know that we have a file, not just a String value. so this parameter can not be null.

Returns​

the config object that can later be included in the REST call configuration

Example​

var data = fileIO.getData("c:/temp/data.json", util.DATA_TEXT, "UTF-8");
var part = netMultipart.forTextFile("data", data, "text/plain", "data.json");

forTextValue​

forTextValue(name, content): TextMultipart

Create a multipart object representing a text, not a text file. Each of these objects will need a name like in an HTML form. Note that this will automatically use the content type "text/plain". example call:

Parameters​

name
string | number | boolean

the name of the form field for the file or text content.

content
string | number | boolean

the content as a String.

Returns​

the config object that can later be included in the REST call configuration

Example​

var data = fileIO.getData("c:/temp/data.json", util.DATA_TEXT, "UTF-8");
var part = netMultipart.forTextValue("data", data);

getURLContent​

getURLContent(pUrl, pResponseAsText, pDefaultCharset, pUserName, pPassword, pEncode?): string

Loads the contents from the specified URL. If you specify userName and password, a basic authentication will be performed.

Parameters​

pUrl
string | number | boolean

The URL, finished encoded. No further encoding is performed

pResponseAsText
boolean

'true' returns the contents from the URL as text, using, if possible, the specified character set; otherwise the default character set you passed.

pDefaultCharset
string | number | boolean

If responseAsText is 'true', this is the default character set provided that no encoding was specified.

pUserName
string | number | boolean

The user name for access; 'null' for anonymous.

pPassword
string | number | boolean

The password for access; 'null' for anonymous.

pEncode?
boolean

If 'true', the URL will be encoded (e.g. by replacing spaces with %20).

Returns​

string

The contents of the URL.

Throws​

May throw an exception.


isValidUrl​

isValidUrl(pUrl, pAllowedSchemes): boolean

Validates a given URL according to RFC 2396. If you don't want to limit the schemes use isValidUrlAnySchemes(...)

The validation process includes: 1. Checking the URL scheme against a list of allowed schemes (case-insensitive) 2. Validating the authority component (hostname and port combination) 3. Verifying scheme presence 4. Verifying the rest of the URL (path, parameters, fragment and so on)

Note: The "file" scheme allows an empty authority component.

Parameters​

pUrl
string | number | boolean

The URL to validate. A null value is considered invalid.

pAllowedSchemes
string[]

Array of schemes to allow. If null or empty, defaults to: ["http", "https", "ftp", "sftp", "file", "mailto", "ssh"]

Returns​

boolean

true if valid, false if invalid

Throws​

May throw an exception.


isValidUrlAnySchemes​

isValidUrlAnySchemes(pUrl): boolean

Validates a given URL according to RFC 2396. All schemes are allowed. If you want to limit the schemes use isValidUrl(...)

The validation process includes: 1. Validating the authority component (hostname and port combination) 2. Verifying scheme presence 3. Verifying the rest of the URL (path, parameters, fragment and so on)

Note: The "file" scheme allows an empty authority component.

Parameters​

pUrl
string | number | boolean

The URL to validate. A null value is considered invalid.

Returns​

boolean

true if valid, false if invalid

Throws​

May throw an exception.

Properties​

DEFAULT_REST_CONNECTION_TIMEOUT​

number

Default Wert ist 0, entspricht keinem gesetzten Timeout.


DEFAULT_REST_READ_TIMEOUT​

number

Default Wert ist 0, entspricht keinem gesetzten Timeout.


DEFAULT_SOAP_CONNECTION_TIMEOUT​

number

Default Wert ist 30000ms.


DEFAULT_SOAP_READ_TIMEOUT​

number

Default Wert ist 60000ms.


DELETE​

string

Constant for the http DELETE method.


GET​

string

Constant for the http GET method.


OPTIONS​

string

Constant for the http OPTIONS method.


PATCH​

string

Constant for the http PATCH method.


POST​

string

Constant for the http POST method.


PUT​

string

Constant for the http PUT method.