AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones específicas para móviles / Funciones de tareas en segundo plano
  • Using a Webservice
DeclareWebserviceContext (Example)
Using a Webservice
This example is used to start a Webservice with all the required initializations.
//----Global declarations of the WebService
// Client name
gsClientName is string
// Manage the client name:
// if the lient name is alreay specified,
// it means that the user is already authenticated
DeclareWebserviceContext(gsClientName)
//---- Global Connection procedure to the Webservice,
// to be called once to initialize the Webservice
PROCEDURE Connection(sUser, sPassword)
// Check that the client exists
IF NOT HReadSeekFirst(CLIENT, NAME, sUser) THEN
RESULT False
ELSE
// Checks the password
IF CLIENT.PASSWORD = sPassword THEN
// Stores the client name
// in the variable stored by DeclareWebServiceContext
gsClientName = sUser
RETURN True
ELSE
RESULT False
END
END
// ---- Global check procedure
// if a connection was established with a valid user/password
PROCEDURE CheckConnection()
IF gsClientName = "" THEN RESULT False ELSE RESULT True
//----Global procedure that requires a connection (with the connection method)
PROCEDURE Calc(nParam1 is int, nParam2 is int)
// Check that the connection was established
IF NOT CheckConnection() THEN ExceptionThrow(1, "Invalid connection/authorization")
// Connection OK, performs the calculation
nResult is int
nResult = nParam1 + nParam2
RESULT nResult
Versión mínima requerida
  • Versión 16
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local