ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Web services
  • Pre-launched sessions
  • Passing parameters in the raw data of the request (POST or PUT method)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
WebserviceParameter (Function)
In french: WebserviceParamètre
AjaxNot available
Gets the value of a parameter in a call to a SOAP or REST web service.
Remarks:
  • Parameters can be passed to a REST web service using two methods:
    • In a URL (URL of type "http://....?Param1=value1&Param2=value2..."). To retrieve the parameter value, use syntax 1 or 2.
    • In the raw data of the request (POST or PUT method). To retrieve the parameter value, use syntax 3.
  • For SOAP web services, parameters are passed in the raw data of the request (POST, PUT, etc.). To retrieve the parameter value, use syntax 3.
Example
// REST web service: retrieves the list of customers
// with an optional filter on the state.
// GET + /Customers[?state=xxx]

sState is string

// Use the syntax 1
sState = WebserviceParameter("state") 

// Use the syntax 2
// sState = WebserviceParameter(1)

IF sState <> "" THEN
HFilter(Customer, State, sState)
END
// REST web service: retrieves the list of customers
// according to the filters specified in POST in JSON.
// POST + /Customers

sCustomerFilter is string
vParameters is Variant 

// Retrieves the parameter value according to syntax 3
sCustomerFilter = WebserviceParameter(paramBuffer)

// Convert the parameter value in a Variant
// to study the content
vParameters = JSONToVariant(sCustomerFilter)
Syntax

Retrieving the value of a parameter identified by its name (REST Webservice only) Hide the details

<Parameter value> = WebserviceParameter(<Parameter name> [, <Encoding>])
<Parameter value>: Character string
Corresponds to:
  • Value of the specified parameter.
  • Empty string ("") if the parameter does not exist or has no value.
<Parameter name>: Character string
Name of the parameter whose value is to be returned.
<Encoding>: Optional Integer constant
Parameter value encoding mode:
paramNoDecodingThe raw value of the parameter is returned. No decoding is performed by WEBDEV. This constant can be used when the encoding of the URL does not comply with the standards used by WEBDEV (e.g., "+" sign not supported, etc.)
paramWithDecoding
(Default value)
The parameter value is automatically decoded by WEBDEV according to the URL encoding/decoding standard.

Retrieving the value of a parameter identified by its index (REST web service only) Hide the details

<Parameter value> = WebserviceParameter(<Parameter index> [, <Encoding>])
<Parameter value>: Character string
Corresponds to:
  • Value of the specified parameter. This value has the following format: <Parameter name> = <Value>.
  • Empty string ("") if the parameter does not exist.
<Parameter index>: Integer
Index of the parameter whose value is to be returned.
<Encoding>: Optional Integer constant
Parameter value encoding mode:
paramNoDecodingThe raw value of the parameter is returned. No decoding is performed by WEBDEV. This constant can be used when the encoding of the URL does not comply with the standards used by WEBDEV (e.g., "+" sign not supported, etc.)
paramWithDecoding
(Default value)
The parameter value is automatically decoded by WEBDEV according to the URL encoding/decoding standard.

Retrieving specific data (raw data of the request sent by a POST or PUT method.) Hide the details

<Result> = WebserviceParameter(<Type of message>)
<Result>: Buffer
Value of the requested message type:
  • Data received.
  • Empty buffer if there is no data.
Remark: A fatal error is thrown if the request does not return data (e.g., DELETE method).
<Type of message>: Integer constant
Type of data to retrieve:
paramBufferRetrieves the raw data that was received (sent by POST or PUT methods).
Remarks

Pre-launched sessions

If your project uses pre-launched sessions, this function must not be used in the project initialization event. This function must only be used in the "Initialize project after connecting to the site" event.

Passing parameters in the raw data of the request (POST or PUT method)

To pass parameters in the raw data of the request (POST or PUT method) from a WINDEV or WEBDEV application, you can use the Content property of a variable of type restRequest.
Component: wd290awws.dll
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/11/2024

Send a report | Local help