ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / HTTP functions
  • Security error in a secure transaction
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Sends a REST request and waits for the server response.
Example
cMyRequest is httpRequest
cMyRequest.URL = "<server address>"
cMyResponse is httpResponse = RESTSend(cMyRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse.Content)
END
// The code sample below explains how to call a WINDEV REST web service with parameters.
// The procedure found in the web service has the following format:
// PRIVATE PROCEDURE UpdateTopBar(bTestMode is boolean)

// The test URL has the following format:
// http://<Server IP>/<Common component>
//?test

// WLanguage code used to call it by passing the parameter
cMyRequest is httpRequest
cMyRequest.Method = httpGet
cMyRequest.URL = "http://<Server IP>/CDM/UpdateTopBar/1" 
//Where CDM is the common component and 1 the parameter value

cMyResponse is httpResponse = RESTSend(cMyRequest)
IF ErrorOccurred THEN
	Error(ErrorInfo(errFullDetails))
ELSE
	IF cMyResponse.Content = True THEN
		Info("The site was updated.")
	ELSE
		Error(cMyResponse.Content)
	END
END
Syntax

Syntax that uses a restRequest variable Hide the details

<REST response> = RESTSend(<REST request>)
<REST response>: restResponse variable
Name of the restResponse variable containing the response received from the REST server.
<REST request>: restResponse variable
Name of the restRequest variable that contains the characteristics of the REST request to be sent to the server.

Simplified syntax for sending a request Hide the details

<REST response> = RESTSend(<URL>)
<REST response>: restResponse variable
Name of the restResponse variable containing the response received from the REST server.
<URL>: Character string
URL to interrogate.
WEBDEV - Browser code

Asynchronous syntax that uses a restRequest variable Hide the details

RESTSend(<HTTP request> , <WLanguage procedure>)
<HTTP request>: restResponse variable
Name of the restRequest variable that contains the characteristics of the REST request to be sent to the server.
<WLanguage procedure>: Procedure name
Name of WLanguage procedure called during the response from the REST server. This procedure has the following format:
PROCEDURE <Procedure name>(<Response> is restResponse)
where <Response> is a restResponse variable containing the response received from the REST server.
WEBDEV - Browser code

Simplified asynchronous syntax for sending a request Hide the details

RESTSend(<URL> , <WLanguage procedure>)
<URL>: Character string
URL to interrogate.
<WLanguage procedure>: Procedure name
Name of WLanguage procedure called during the response from the REST server. This procedure has the following format:
PROCEDURE <Procedure name>(<Response> is restResponse)
where <Response> is a restResponse variable containing the response received from the REST server.
Remarks
  • WindowsLinux To find out the runtime errors of this function, use ErrorOccurred and ErrorInfo.
  • WEBDEV - Browser code Access to REST APIs from a domain other than the one hosting the site from a browser code (Cross-domain) is blocked by default (Cross-Origin Request Blocked). To avoid being blocked, specific authorizations must be configured on the Web server. This topic is covered in the following post on the support blog: https://blogs.pcsoft.fr/fr/autoriser-acces-api-rest-domaine-cors

Security error in a secure transaction

During a secure transaction, the request may fail due to security errors:
  • invalid certificate or certificate coming from an unknown company.
  • the site name specified in the certificate does not correspond to a server.
  • invalid or expired certificate date.
  • redirection to a non-secure server.
These errors are returned by ErrorInfo.
If one of these errors occurs, you can re-run the request while ignoring the errors. To do so, simply modify the IgnoreError property of the httpRequest variable:
Error returned by ErrorInfo
(with the errCode constant)
Value of the IgnoreError property of the restRequest variable
(these values can be combined)
Description
httpErrorInvalidCertificate
Invalid certificate or certificate coming from an unknown company.
httpIgnoreInvalidCertificateThe certificate is ignored.
httpErrorInvalidCertificateName
The name of the site specified in the certificate does not correspond to a server.
httpIgnoreInvalidCertificateNameThe site name specified in the certificate is ignored.
httpErrorExpiredCertificate
Invalid or expired certificate date.
httpIgnoreExpiredCertificateThe certificate date is ignored.
httpIgnoreDeprecatedIgnores errors related to the use of deprecated algorithms (e.g. SHA-1 certificate signature).
httpErrorRedirectToHTTP
Redirection to a non-secure server.
httpIgnoreRedirectToHTTPThe redirection to a non-secure server is allowed.
httpIgnoreRedirectToHTTPS
Redirection to a secure server.
httpIgnoreRedirectToHTTPSThe redirection to a secure server is allowed.
httpIgnoreUnsafeRenegotiationIgnores the error stating that the server does not support secure renegotiation (RFC 5746).
httpIgnoreRevocationThe certificate found in the list of revoked certificates is not checked.

Remarks:
  • When the HTTP queries are run in several threads, the HTTP.IgnoreError variable has a specific value for each thread.
Business / UI classification: Business Logic
Component: wd300com.dll
Minimum version required
  • Version 20
This page is also available for…
Comments
Video httpput
PROPAGANDA AULA 2025 RESTREQUEST
https://youtu.be/cJZm-WrAPgM
AULA COMPLETA 2025 RESREQUEST
https://youtu.be/d3zULOtHQjs
https://windevdesenvolvimento.blogspot.com/2019/02/dicas-2025-windev-mobile-webservice-021_23.html
// BTN_ALTERA_httpPut
solicitacao_http is restRequest
URL is string="http://nots-amarildo/empresa/{nEmpresaId}"
URL = Replace(URL,"{nEmpresaId}","2")
solicitacao_http..URL=URL
solicitacao_http..ContentType="application/json"
solicitacao_http..Method=httpPut
solicitacao_http..Content=[
{
"razao_social"
:
"ALTERADO1205"
}
]
resposta_http is restResponse = RESTSend(solicitacao_http)
EDT_RETORNO=resposta_http..Content
amarildo
23 Feb. 2019
Video RestSend
PROPAGANDA DA AULA PRIVADA RESTSEND
https://youtu.be/933LvEUWFIA
AULA PRIVADA COMPLETA RESTSEND SOMENTE PARA COLABORADORES GRUPO PRIVADO
https://youtu.be/LfOcn4tyBww
https://windevdesenvolvimento.blogspot.com/2019/02/dicas-2024-windev-mobile-webservice-020.html

// BTN_ADICIONA_httpPost
solicitacao_http is restRequest
solicitacao_http..URL="http://nots-amarildo/empresa"
solicitacao_http..Method=httpPost
solicitacao_http..ContentType="application/json"
solicitacao_http..Content=[
{
"razao_social"
:
"NOVO0645"
}
]
resposta_http is restResponse=RESTSend(solicitacao_http)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
EDT_RETORNO=resposta_http..Content
END
amarildo
22 Feb. 2019
Video RestSend


https://youtu.be/G7oY3hd7Jo0

https://windevdesenvolvimento.blogspot.com/2019/02/dicas-2023-windev-mobile-webservice-019.html

solicitacao_http is restRequest
sUrl is string="http://localhost/empresa/{nEmpresaid}"
sUrl=Replace(sUrl,"{nEmpresaid}","2")
solicitacao_http..URL=sUrl
solicitacao_http..Method=httpGet
resposta_http is restResponse = RESTSend(solicitacao_http)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
EDT_RETORNO=resposta_http..Content
END

amarildo
22 Feb. 2019
Video RestSend
https://youtu.be/VvMa-5kUZkQ

https://windevdesenvolvimento.blogspot.com/2019/02/dicas-2022-windev-mobile-webservice-018.html

solicitacao_http is restRequest
solicitacao_http..URL="http://nots-amarildo/empresa"
solicitacao_http..Method=httpGet
resposta_http is restResponse = RESTSend(solicitacao_http)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
EDT_RETORNO=resposta_http..Content
END
amarildo
20 Feb. 2019

Last update: 12/16/2024

Send a report | Local help