net
Methods
callRestWebservice
callRestWebservice(
pRestConfig,pAuthConfig):string
Call a Rest webservice with a configuration object for rest webservice calls.
Parameters
Returns
stringThe 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
string | number | booleanServeradresse an den die Anfrage geschickt wird
string | number | booleanArt der Anfrage (GET, POST, PUT, DELETE) muss vorhanden sein
anyParameter für die Anfrage, kann auch null sein
string | number | booleander Inhalt des Requests, kann null sein
anyfür die Anfrage, kann auch null sein
string | number | booleangewünschter Typ der Antwort, muss vom Server unterstützt werden, siehe MediaType (default = "text/plain"")
string | number | booleander Typ der gesendeten Anfrage an den Server (default = "text/plain")
numberder Datentyp im ADITO für die empfangenen Daten (a.DATA_TEXT, a.DATA_BINARY)
numberder Datentyp im ADITO für die gesendeten Daten (a.DATA_TEXT, a.DATA_BINARY)
string | number | booleander Benutzername
string | number | booleandas Passwort
booleanTrue = Liefert eine JSON als Response zurück; False = Liefert den Body der Response
Returns
stringThrows
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
string | number | booleanServeradresse an den die Anfrage geschickt wird
string | number | booleanArt der Anfrage (GET, POST, PUT, DELETE) -> muss vorhanden sein
anystring | number | booleander Inhalt des Requests, kann null sein
anyfür die Anfrage, kann auch null sein
string | number | booleangewünschter Typ der Antwort, muss vom Server unterstützt werden, siehe MediaType (default = "text/plain")
string | number | booleander Typ der gesendeten Anfrage an den Server (default = "text/plain")
numberder Datentyp im ADITO für die empfangenen Daten (a.TYPE_TEXT, a.TYPE_BINARY)
numberder Datentyp im ADITO für die gesendeten Daten (a.TYPE_TEXT, a.TYPE_BINARY)
booleanTrue = Liefert eine JSON als Response zurück; False = Liefert den Body der Response
Returns
stringThrows
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
string | number | booleanServeradresse an den die Anfrage geschickt wird
string | number | booleanArt der Anfrage (GET, POST, PUT, DELETE) -> muss vorhanden sein
anystring | number | booleander Inhalt des Requests, kann null sein
anyfür die Anfrage, kann auch null sein
string | number | booleangewünschter Typ der Antwort, muss vom Server unterstützt werden, siehe MediaType (default = "text/plain")
string | number | booleander Typ der gesendeten Anfrage an den Server (default = "text/plain")
numberder Datentyp im ADITO für die empfangenen Daten (a.TYPE_TEXT, a.TYPE_BINARY)
numberder Datentyp im ADITO für die gesendeten Daten (a.TYPE_TEXT, a.TYPE_BINARY)
string | number | booleanSignatur-Methode z.B. HMAC-SHA1
string | number | booleanBenutzer Schlüssel
string | number | booleanToken
string | number | booleanZeitstempel (kann null sein, dann default)
string | number | booleanRealm (kann null sein, dann default)
string | number | booleanNonce (kann null sein, dann default)
string | number | booleanVersion (kann null sein, dann default)
string | number | booleanBenutzer Secret z.B. API-Key
string | number | booleanTokenSecret
booleanTrue = Liefert eine JSON als Response zurück; False = Liefert den Body der Response
Returns
stringThrows
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
string | number | booleanServeradresse an den die Anfrage geschickt wird
string | number | booleanArt der Anfrage (GET, POST, PUT, DELETE) -> muss vorhanden sein
anystring | number | booleander Inhalt des Requests, kann null sein
anyfür die Anfrage, kann auch null sein
string | number | booleangewünschter Typ der Antwort, muss vom Server unterstützt werden, siehe MediaType (default = "text/plain")
string | number | booleander Typ der gesendeten Anfrage an den Server (default = "text/plain")
numberder Datentyp im ADITO für die empfangenen Daten (a.TYPE_TEXT, a.TYPE_BINARY)
numberder Datentyp im ADITO für die gesendeten Daten (a.TYPE_TEXT, a.TYPE_BINARY)
string | number | booleander Access-Token
booleanTrue = Liefert eine JSON als Response zurück; False = Liefert den Body der Response
Returns
stringThrows
May throw an exception.
callSoapWebservice
callSoapWebservice(
pSoapConfig,pAuthConfig):any[]
Call a Soap webservice with a configuration object for Soap webservice calls.
Parameters
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
string | number | booleanServer address to which the request will be sent.
string | number | booleanthe requests xml as string
string | number | booleanthe action to execute on the webservice
string | number | booleanthe user for authentification
string | number | booleanthe password for authentification
anythe request headers
anythe 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
string | number | booleanServer address to which the request will be sent.
string | number | booleanthe requests xml as string
string | number | booleanthe action to execute on the webservice
anythe request headers
anythe 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
string | number | booleanthe name of the form field for the file.
anythe content as a Base64 encoded String.
string | number | booleanthe content type, e.g. "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
string | number | booleanthe 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
string | number | booleanthe name of the form field for the file or text content.
string | number | booleanthe content as a String.
string | number | booleanthe content type, e.g. "plain/text" (defailt value is the same)
string | number | booleanthe 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
string | number | booleanthe name of the form field for the file or text content.
string | number | booleanthe 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
string | number | booleanThe URL, finished encoded. No further encoding is performed
boolean'true' returns the contents from the URL as text, using, if possible, the specified character set; otherwise the default character set you passed.
string | number | booleanIf responseAsText is 'true', this is the default character set provided that no encoding was specified.
string | number | booleanThe user name for access; 'null' for anonymous.
string | number | booleanThe password for access; 'null' for anonymous.
booleanIf 'true', the URL will be encoded (e.g. by replacing spaces with %20).
Returns
stringThe contents of the URL.
Throws
May throw an exception.
isValidUrl
isValidUrl(
pUrl,pAllowedSchemes):boolean
Checks if an URL is valid
Parameters
string | number | booleanthe URL, you want to check
string[]The schemes, that should be valid as a one dimensional array. If this parameter is null or the array doesn't contain entries, the default is used. The default is: ["http", "https", "ftp", "sftp", "file", "mailto", "ssh"]
Returns
booleantrue if valid, false if invalid
Throws
May throw an exception.
isValidUrlAnySchemes
isValidUrlAnySchemes(
pUrl):boolean
Checks if an URL is valid. All schemes are allowed.
Parameters
string | number | booleanThe URL, you want to check
Returns
booleantrue if valid, false if invalid
Throws
May throw an exception.
Properties
DEFAULT_REST_CONNECTION_TIMEOUT
numberDefault Wert ist 0, entspricht keinem gesetzten Timeout.
DEFAULT_REST_READ_TIMEOUT
numberDefault Wert ist 0, entspricht keinem gesetzten Timeout.
DEFAULT_SOAP_CONNECTION_TIMEOUT
numberDefault Wert ist 30000ms.
DEFAULT_SOAP_READ_TIMEOUT
numberDefault Wert ist 60000ms.
DELETE
stringConstant for the http DELETE method.
GET
stringConstant for the http GET method.
OPTIONS
stringConstant for the http OPTIONS method.
PATCH
stringConstant for the http PATCH method.
POST
stringConstant for the http POST method.
PUT
stringConstant for the http PUT method.