ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage syntax / Structured statements
  • Webservice: how do I get the webservice response?
  • Syntax for SOAP web services
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Runs a process only after a given procedure has been executed, and continues to execute the current code while waiting for this procedure to end. This type of instruction is used to:
  • call a SOAP web service asynchronously.
  • call a browser procedure (with a return value) from a WEBDEV Page control.
  • call a window procedure (with a return value) from a page contained in a WEBDEV Page control.
Example
trackingSearch is trackSearch
trackingSearchRes is resultTrackSearch
trackingSearch.accountNumber = 99999999
trackingSearch.consigneesCountry = "FR"
trackingSearch.consigneesZipCode = "37100"
trackingSearch.sendersRef = "111111"

AFTER trackingSearchRes = TrackingServiceWSService.trackSearch(trackingSearch) DO
	IF ErrorOccurred() THEN
		Trace("Echec de l'appel au service Web : " + ErrorInfo(errFullDetails))
	ELSE
		Trace("Webservice correctement exécuté")
	END
END
Syntax

Asynchronous call to a SOAP web service Hide the details

AFTER <Result> = <SOAP web service call> DO
      <Code executed if response>
END
<Code executed after SOAP web service call>
<AFTER>:
Marks the beginning of the statement block.
<Result>:
Result of the execution of the SOAP web service.
<SOAP web service call>:
Call to the procedure used to query the SOAP web service.
<Code executed if response>:
Code executed only if the SOAP web service has been executed and has sent the response.
<Code executed after SOAP web service call>:
Code executed directly after the call to the SOAP web service (whether or not the SOAP web service sent a response).
<END>:
Marks the end of the statement block.
WEBDEV - Server code

WEBDEV Page control: call a window procedure (with a return value) from a page Hide the details

AFTER <Result> = MyHostControl.ProdcedureName() DO
<Code executed if response>
END
<Code executed after call to procedure>
<AFTER>:
Marks the beginning of the statement block.
<Result>:
Result of the procedure of the window containing the WEBDEV Page control.
<MyHostControl.ProcedureName()>:
Call to the procedure associated with the window from the page contained in the WEBDEV Page control.
<Code executed if response>:
Code executed only if the procedure has been executed and has sent the response.
<Code executed after call to procedure>:
Code executed directly after the call to the procedure (whether or not the procedure sent a response).
<END>:
Marks the end of the statement block.
Remarks

Webservice: how do I get the webservice response?

The web service response can be retrieved in <Code executed if response>. Several syntaxes are available:
  • Declaration of the return value in the block AFTER ... DO:
    In this case, the web service returns a wsResponse variable. To be manipulated, this variable must be explicitly assigned to the variable used to retrieve the result of the web service.
    AFTER x = Websevice_Call() DO
    // here x is a wsResponse, it must be explicitly assigned
    // in a variable of the web service return type
    Res is TypeWS = x
    // code executed after the web service response
    //.... = Res
    END
    // code executed immediately
  • Return value declaration outside the block AFTER ... DO:
    In this case, the return variable can be manipulated directly.
    Res is TypeWS
    AFTER Res  = WebseviceNoResponse() DO
    // code executed after the web service response
    //.... = Res
    END
    // code executed immediately

Syntax for SOAP web services

  • This syntax can only be used for calling SOAP web services.
  • The <Code executed if response> is executed as a Callback procedure once the web service has been executed and has sent a response.
  • Important: code executed after a call to the SOAP webservice (after the FIN keyword) is executed in the context of the calling thread. If the call is made in the main thread, the execution of a wait function (ThreadPause, Multitask, EventWait, etc.) will cause a deadlock.
  • The ErrorOccurred WLanguage variable can be used to handle possible errors during the call to the SOAP web service. For example:
    // Appelle le Webservice SOAP de vérification du numéro de TVA
    AFTER MaRéponse = checkVat(sPays, sNumTVA) DO
    	// Si on a eu une erreur
    	IF ErrorOccurred THEN
    		...
    	END
    END
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/16/2025

Send a report | Local help