|
|
|
|
|
- Operating mode
- Special case: using an intermediate WebService
DeclareWebserviceContext (Function) Allows you to declare a list of variables whose value will be persistent between successive calls to a web service. This function indicates the variables that will be saved and restored during each call to the web service. This gives you the ability to manage a context in the web service. DeclareWebserviceContext is taken into account when running the web services deployed on the WEBDEV Application Server (Webservice in .AWWS). It is recommended to use this function in the "Initialization" event of the project (for project variables) and/or in the initialization code of classes or sets of procedures. In most cases, this function must be used in the process where the variables are declared and initialized. If your project uses pre-launched sessions, this function must not be used in the project initialization event. This function must be used in the "Initialization in pre-launched session mode" event. Caution: - This function is intended to the developers with a good knowledge of WINDEV/WEBDEV.
- By default, a REST web service does not have a context. Therefore, this function cannot be used in a REST web service.
gnNumCurrentProduct is int = 1
DeclareWebserviceContext(gnNumCurrentProduct)
Sintaxis
<Result> = DeclareWebserviceContext(<Variable name 1> [, <Variable name 2> [... [, <Name of variable N>]]])
<Result>: Boolean - True if the specified variables have been restored,
- False otherwise (during the first call to the web service for example).
<Variable name 1>: Variable type Name of the first variable that will be saved at the end of the display. The value of this variable will be retrieved during the successive calls to the web service. <Variable name 2>: Variable type Name of the second variable that will be saved at the end of the display. The value of this variable will be retrieved during the successive calls to the web service. <Name of variable N>: Variable type Name of Nth variable that will be saved at the end of display. The value of this variable will be retrieved during the successive calls to the web service. Observaciones Operating mode - The context is always saved on disk and transmitted via a SOAP header.
- DeclareWebserviceContext uses contexts on disk. The values of variables are always restored.
- The total size of values for the different variables is not limited.
- DeclareWebserviceContext can be used for sensitive data (user password, for example).
- If two variables are saved with the same name (one in the project and the other one in a page for example), the two variables are stored independently.
- DeclareWebserviceContext returns False if one of the variables was not restored.
- All the variables passed to DeclareWebserviceContext when a web service is called can be retrieved during the next call. Variables previously passed are automatically saved again.
- Variables of simple type (integer, string, etc.) are managed, as well as variables of structure, class, array or associative array type.
- Fixed arrays, global class members, associative arrays of local structures and advanced WLanguage types (such as Connexion variables) are not supported.
Special case: using an intermediate WebService In some cases, you may have to use an intermediate web service to use the variables. Let's study the following case: - A "WS1" web service uses DeclareWebserviceContext for a global variable named "globalString". This web service contains 2 functions:
- "Write(param)" that assigns "param" in "globalString"
- "Read()" that returns the content of "globalString".
- A client executable, consuming WS1, calls "WS1.Write("Hello")", then "WS1.Read()" retrieves the string sent.
- An intermediate web service "WS2", consuming WS1, contains 2 functions:
- "Write(param)" that calls "WS1.Write()".
- "Read()" that calls "WS1.Read()".
- A client executable, consuming WS2, calls "WS2.Write("Hello")", then "WS2.Read()" DOES NOT retrieve the string sent.
Solution: In the WS2 web service, use an "EcritLit()" function that does "WS1.Ecrit()" and "WS1.Lit()" in the same processing. Componente: wd300awws.dll
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|