-
Notifications
You must be signed in to change notification settings - Fork 0
Home
- BindingUrl = 'http://localhost'
- Port = '9080'
- Basedir = 'resources'
- ErrorHandling = 'SilentlyContinue'
- RequestOutput = 'false'
- ResponseOutput = 'false'
Method: POST
- Status code: 200
- HTML-body: Success!
Method: POST
- Status code: 200
- HTML-body: Success!
- Checks if content type is 'text/xml; charset=UTF-8', if not the server will log 'Invalid content type'.
- Identifier lookup (More details below). If no match is found the server will log 'No identifier found...'.
- Convert content of http request from XML to PSObject. Each item will result in a PSObject and each item property will be added to each PSObject as a Property. Each object is added to an array namned 'easitObjects'.
- Setting "execDir". execDir = "PathToStart-start-httpserver.ps1\ValueFromParameterNamedBasedir"
- Setting "executable". executable = "$execDir$identifier.ps1"
- Executing executable with cmdlet Start-Job and passing in the array 'easitObjects' and variable 'execDir'.
Method: POST
- Status code: 200
- HTML-body: Success!
- Checks if content type contains 'application/json', if not the server will log 'Invalid content type'.
- Converts content of http request from json to PSObject with cmdlet ConvertFrom-Json, result is stored in array 'requestObjects'.
- Identifier lookup (More details below). If no match is found the server will log 'No identifier found...'.
- Setting "execDir". execDir = "PathToStart-start-httpserver.ps1\ValueFromParameterNamedBasedir"
- Setting "executable". executable = "$execDir$identifierJSON.ps1"
- Executing executable with cmdlet Start-Job and passing in the array 'requestObjects' and variable 'execDir'.
Method: GET
- Status code: 200
- HTML-body: Staus: OK!
Method: GET
- Status code: 200
- HTML-body: Stopping powershell http server... Goodbye!
Method: GET
- Status code: 200
- HTML-body: Stopping powershell http server... Goodbye!
- Status code: 204
- HTML-body: Unknown endpoint or action!
Depending on what content type is used lookup for identifier is approach diffently.
In the case of content type xml the following regex 'itemIdentifier">(.)</' is used for lookup. itemIdentifier is an property that you can specify in the export configuration in Easit GO. If itemIdentifier is not found the following regex is used 'identifier">(.)</'. identifier is an property specified in the item event rule in Easit GO. All lookups is done against the http request body.
In the case of content type json the following regex '(?|&)identifier=(.*)(&)?' is used against the request URL for lookup. If identifier is not found in the request URL the same method for lookup as for content type xml is used.
Logging is handled by inline function name 'Write-CustomLog'. Behaviour for this function can be changed by changing values in loggerSettings.xml Default logging is done at INFO-level to PShttpServer.log in the same folder as start-httpserver.ps1 is in.
- LogName = 'PShttpServer' (Name of logfile for PSHttpServer)
- LogDirectory = 'logs' (Subfolder, relative to start-httpserver.ps1, where logs are written to)
- LogLevelSwitch = 'INFO' (Level of logging output)
- writeToHost = 'false' (If script is running in console and output should be written to host, change to true)
- ErrorHandling = 'SilentlyContinue' (How should server handle errors, if this is set to Stop script will stop upon an error)
- RotationInterval = '30' (For how many days should logs be saved)