version 11.3 (Modified)
SET WEB SERVICE OPTION (option; value)
Parameter | Type | Description | |
option | Longint | Code of the option to set | |
value | Longint | Text | Value of the option |
Preliminary note: This command is designed for advanced Web Services users. Its use is optional.
Description
The SET WEB SERVICE OPTION command allows you to set different options that will be used during the next SOAP request triggered using the CALL WEB SERVICE command.
You can call this command as many times as there are options to be set.
In the option parameter, pass the number of the option to set and in the value parameter, pass the new value of the option. For these parameters, you can use one of the following predefined constants of the "Web Services (Client)" theme:
Constant (option param) | Type | Value |
Web Service HTTP Timeout | Longint | 1 |
Web Service SOAP Header | Longint | 2 |
Web Service SOAP Version | Longint | 3 |
Web Service display auth dialog | Longint | 4 |
Web Service reset auth settings | Longint | 5 |
Web Service HTTP Compression | Longint | 6 |
Constant (value param) | Type | Value |
Web Service SOAP_1_1 | Longint | 0 |
Web Service SOAP_1_2 | Longint | 1 |
Web Service Deflate Compression | Longint | 1 |
The following details each of the options and possible values:
option = Web Service HTTP Timeout
value = timeout of the client portion expressed in seconds.
The timeout of the client portion is the wait period of the Web Service client in case the server does not respond. After this period, the client closes the session and the request is lost.
This timeout is 10 seconds by default. It can be modified for specific reasons (network status, Web Service specifics, etc.).
option = Web Service SOAP Header
value = XML root element reference to insert as a header in the SOAP request.
This option allows you to insert a header in a SOAP request generated using the CALL WEB SERVICE command. SOAP requests do not contain a specific header by default. However, certain Web Services require a header, for example when managing identification parameters.
option = Web Service SOAP Version
value = Web Service SOAP_1_1 or Web Service SOAP_1_2
This option lets you specify the SOAP protocol version used in the request. Pass the Web Service SOAP_1_1 constant in value to indicate version 1.1 and Web Service SOAP_1_2 to indicate version 1.2.
option = Web Service display auth dialog
value = 0 (do not display dialog box) or 1 (display dialog box)
This option manages the display of the authentication dialog box during execution of the CALL WEB SERVICE command. By default, this command never displays the dialog box; normally, you have to use the AUTHENTICATE WEB SERVICE command to do so. However, if you want the authentication dialog box to appear in order for the user to enter their identifiers, you will need to use this option: pass 1 in value to display the dialog box and 0 otherwise. The dialog box only appears if the Web service requires authentication.
option = Web Service reset auth settings
value = 0 (do not erase information) or 1 (erase information)
This option lets you indicate to 4D whether to memorize the authentication information of the user (user name, password, method, etc.), in order to reuse it subsequently. By default, this information is erased after each execution of the CALL WEB SERVICE command. Pass 0 in value to store the information and 1 to erase it. Note that when you pass 0, the information is kept during the session but is not stored.
option = Web Service HTTP Compression
value = Web Service Deflate Compression
This option is used to enable an internal compression mechanism for SOAP requests in order to accelerate inter-4D application exchanges. When you execute the statement SET WEB SERVICE OPTION(Web Service HTTP Compression ; Web Service Deflate Compression) on the 4D client of the Web Service, the data of the next SOAP request sent by the client will be compressed using a standard HTTP mechanism before being sent to the 4D SOAP server. The server will decompress and parse the request, then will reply automatically using the same mechanism. Only the request that follows the call to the SET WEB SERVICE OPTION command is affected. You must therefore call this command each time you want to use compression. By default, 4D does not compress Web Service HTTP requests.
Notes:
"Deflate" is the name of the compression algorithm used internally by 4D.
This mechanism cannot be used for requests sent to a 4D SOAP server whose version is earlier than 11.3.
So that you can further optimize this functioning, additional options configure the threshold and compression rate of the requests. These options can be accessed via the SET DATABASE PARAMETER command.
The order in which the options are called is not important. If the same option is set several times, only the value of the last call is taken into account.
Examples
1. Insertion of a customized header in the SOAP request:
` Creating an XML reference C_STRING(16;vRootRef;vElemRef) vRootRef:=DOM Create XML Ref("RootElement") vxPath:="/RootElement/Elem1/Elem2/Elem3" vElemRef:=DOM Create XML element(vRootRef;vxPath) `Modifying SOAP header with reference SET WEB SERVICE OPTION(Web Service SOAP Header;vElemRef)
2. Using version 1.2 of the SOAP protocol:
SET WEB SERVICE OPTION(Web Service SOAP Version;Web Service SOAP_1_2)
See Also