CX_WEB_SERVICE_MANAGER
158269
Class hierarchy
- CX_CLASS
- CX_WEB_SERVICE_MANAGER
Description:
Class of the WebService Manager.
In order to provide an HTTP interface for ClassiX, the WebService Manager is used. It is started with the function "Start" and then forwards incoming HTTP requests to the corresponding messages. The message can now obtain the information it needs to generate the required CX_HTTP_RESPONSE response object from the CX_HTTP_REQUEST object lying on the stack. To operate the Web service over HTTPS, useSSL must be TRUE and the environment variables CX_HTTPS_KEY_FILE and CX_HTTPS_CERT_FILE must contain the file path to a valid private key and certificate.
To obtain the name of the message to be addressed, the path of the requested URL is extended by "_" and the method of the request. For an example, see the documentation of the CX_HTTP_REQUEST class.
The WebService Manager is also responsible for establishing a connection to the MorphIT server and offers methods to query the status of this connection and to communicate with the MorphIT server to a certain extent.
MorphIT status
Here the status methods for the MorphIT connection are shown in a matrix for better understanding. As a reference for the different states a ClassiX instance can be in, the following picture from the MorphIT overview is used The colors of the second column indicate to which element of the graphic the row refers.
Status | HasMorphITConnection | IsMorphITClientConnected | IsMorphITWebService | IsStaticMorphIT | |
---|---|---|---|---|---|
ClassiX process just started | FALSE | FALSE | FALSE | FALSE | |
ClassiX started on stock (without client) | TRUE | FALSE | FALSE | TRUE | |
Web service MorphIT instance | TRUE | FALSE | TRUE | TRUE | |
MorphIT-ClassIX instance (client connected) | TRUE | TRUE | FALSE | TRUE |
If the MorphIT server is not started in static mode, the following possible combinations are available:
Status | HasMorphITConnection | IsMorphITClientConnected | IsMorphITWebService | IsStaticMorphIT | |
---|---|---|---|---|---|
ClassiX process just started (still no connection to the MorphIT server) | FALSE | FALSE | FALSE | FALSE | |
ClassiX started on stock (without client) | TRUE | FALSE | FALSE | FALSE | |
MorphIT-ClassiX instance (client connected) | TRUE | TRUE | FALSE | FALSE | |
Native ClassiX with WebWidgets | TRUE | FALSE | FALSE | FALSE |
If a ClassiX is only operated natively and without a MorphIT server (i.e. also without web widgets), then this corresponds to the first case (all FALSE).
Function | Parameters | Return | Brief description |
---|---|---|---|
ExtractTextFromHtml | STRING | STRING | Filters the actual text from an HTML document |
URLEncode 192935 | STRING | STRING | Encodes URLs according to the percentage encoding |
URL decode 192935 | STRING | STRING | Decoded encoded URLs |
XMLEncode 192935 | STRING | STRING | Encodes characters in texts to HTML entities according to XML standard |
XML decode 192935 | STRING | STRING | Decodes texts with HTML entities, as well as Unicode code points, to a regular text |
WebService functionality | |||
Start | Starts the WebService Manager and binds it to the specified port | ||
Stop | Stops the WebService Manager | ||
IsRunning | INTEGER | Returns TRUE if the server is running, otherwise FALSE | |
SetReceiveMessage | INTEGER | Sets the message that is sent when a request is received. (NULL = do not send message) The sent message receives the CX_HTTP_REQUEST object on the stack. If this is changed, the actual message also receives the changed request object | |
SetSendMessage | INTEGER | Sets the message that is sent before the reply is sent. (NULL = do not send message) The sent message receives the CX_HTTP_RESPONSE object on the stack, which is returned as a response once processing of the registered message is complete. | |
SendRequest 184192 | CX_HTTP_REQUEST | CX_HTTP_RESPONSE | Sends an HTTP request with the parameters specified in the request object and returns a response object as the result. |
MorphIT functionality | |||
ClearMorphITProperties 188438 | Deletes all set MorphIT properties. | ||
CloseMorphITConnection 186192 | Closes an open web socket connection to the MorphIT server. The instance will continue to be managed by the launcher and if the server is shut down, the instance will be terminated by the launcher. | ||
DeregisterMorphITConnection 197830 | Similar to CloseMorphITConnection with the difference that the MorphIT server no longer tracks the instance after this command and a launcher instance is not terminated via the launcher. | ||
ExportView 228710 | CX_WIDGET, INTEGER | CX_JSON_OBJECT | Exports the current state of the interface in MorphIT JSON format. |
GetMorphITProperty 202211 | STRING | STRING | Returns the current value of a MorphIT property set by SetMorphITProperty. If the property is not set, an empty string is returned. |
HasMorphITConnection 186192 | INTEGER | Returns TRUE if ClassiX successfully connected and registered with the MorphIT server. | |
HasMorphITProperty 202211 | STRING | INTEGER | Returns TRUE if the specified MorphIT property is currently set. |
IsMorphITClientConnected 189884 | INTEGER | Returns TRUE if ClassiX successfully connected and registered with the MorphIT server and a MorphIT client (browser) connected to this ClassiX instance. | |
IsMorphITWebService 195636 | INTEGER | Returns TRUE if the MorphIT server is in static mode and this ClassiX instance is used as WebService instance. | |
IsStaticMorphIT 195942 | INTEGER | Returns TRUE if the client has a MorphIT connection (HasMorphITConnection) and the MorphIT server is running in static mode. | |
LaunchDedicatedClassiX 204654 | STRING, STRING, STRING, CX_JSON_OBJECT | INTEGER | Starts a dedicated ClassiX instance on the given MorphIT launcher. |
MapMorphITAssetPath 224640 | STRING | STRING | Translates a local path into a MorphIT server path. |
MorphITServerCommand 205954 4.2.0 | CX_JSON_OBJECT | CX_JSON_OBJECT | Sends a server command to the connected MorphIT server and puts the response back on the stack. |
OpenMorphITConnection 186192 | INTEGER, STRING, INTEGER, STRING | Opens a web socket connection to the MorphIT server. The parameters define the connection end point. | |
RemoveMorphITProperty 188438 | STRING | Deletes a set property under the specified name. | |
RequestMorphITBinding 204654 | CX_JSON_OBJECT | ZERO | STRING | Registers the start of a dedicated ClassiX instance with the MorphIT server and notifies a possibly connected MorphIT client. |
SetMorphITProperty 188438 | STRING, STRING | Sets a property, which can be transferred to the Web browser each time MorphIT is loaded and interpreted there. | |
SkipNextViewExport 201506 | Skips the next export of the interface to MorphIT. |
Data field | Type | Standard value | Brief description |
---|---|---|---|
port | INTEGER | 443 | Defines the port to which the WebService Manager will bind itself. This must be set before "Start" is called. |
useSSL | CHAR | TRUE | If TRUE, the WebService is started as an HTTPS service, otherwise it is started as an HTTP service |
receiveMessage | INTEGER | NULL | The message that is sent when a request is received by the Web service. |
sendMessage | INTEGER | NULL | The message that is sent when a response is sent to the client. |