ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing and consuming a web service / Developing and consuming a SOAP web service
  • Overview
  • How do you provide a SOAP web service?
  • SOAP web service creation
  • Managing contexts
  • Using an HFSQL database
  • SOAP web service generation
  • Deploying a web service and running its test
  • Deploying a web service
  • Special case: Deploying and testing a web service on the local computer
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
WINDEV and WEBDEV allow you to generate web services directly. Then, these web services can be used in the WINDEV, WEBDEV, WINDEV Mobile projects or in any other language.
A web service includes a set of functions WITHOUT interface. Indeed, this type of module being run on a server, there is no need to develop a user interface. Therefore, the web service will include WLanguage functions organized in sets of procedures. These functions can use a database (HFSQL, Oracle, AS/400, etc.).
There are two types of web services:
Please note Deploying a WINDEV or WEBDEV SOAP webservice requires the use of a WEBDEV Application Server. Thanks to this distribution mode, SOAP web services created with WINDEV/WEBDEV offer several types of advantages:
  • Web services deployed on a WEBDEV Application Server (compatible with all the Web servers).
  • Numerous web service deployment options (HTTP, FTP, Cloud).
  • Heavy workload possible.
  • Web services that can operate on all the Windows versions (32 and 64 bits) as well as in Linux.
How do you provide a SOAP web service?
To make a SOAP web service available, simply:
  1. Creating a SOAP web service.
  2. Generate a SOAP web service.
  3. SOAP Webservice deployment on a WEBDEV Application Server.
Note: To test the SOAP web service, you can deploy it locally for test.
SOAP web service creation
To create a SOAP web service:
  1. Create a web service SOAP WINDEV or WEBDEV project, or a web service SOAP configuration in an existing project.
    • When creating a project, select "SOAP or REST web service".
      Then select "SOAP Webservice".
    • To create a SOAP webservice project configuration, in the "Project Explorer" pane, open the "Configurations" context menu and select "New configuration". In the wizard that launches, select "SOAP or REST web service" then "SOAP web service".
  2. Create one or more sets of procedures:
    • In the "Project Explorer" pane, select the "Procedures" folder.
    • Select "New" in the context menu..
  3. Create the global procedures or the functions corresponding to the processes that must be performed on the server.
    // Procédure globale Addition
    PROCEDURE Addition(nNombre1 is int, nNombre2 is int)
    
    nRésultat is int
    nRésultat = nNombre1 + nNombre2
    
    RETURN nRésultat

    Each global procedure can be run by the WEBDEV Application Server.

    Remarks:
    • Parameter typing If Procedure parameters are not typed, they will automatically be received as Unicode character strings. Therefore, you must specify the type of the parameters that must be different from a Unicode character string.
    • Scope of procedures The procedures can be public, restricted or private.
      • A public procedure can be used in projects that import the SOAP webservice.
      • A private procedure cannot be used in projects that import the SOAP web service (the procedure will not be visible in the "Project Explorer" pane).
      • A restricted procedure can be used throughout the project, but will not be exported when a web service or external Component is generated.
      Note: It is possible to specify the scope of a procedure:
      • when creating the procedure.
      • via the Procedure context menu in the "Project Explorer" pane.
    • Return value Procedures can return classes, structures, arrays of structures or arrays of classes. The returned arrays are limited to one dimension.
    Attention The SOAP web service must have no GUI/UI (no window, status, trace window or dialog box). It is also limited by the rights defined on the Web server ("Internet guest" account in Windows).
  4. Type (if necessary) the initialization code and the project closing code. These two codes will be respectively run when loading and when unloading the library of the web service.

Managing contexts

To keep the value of global variables during successive calls to a web service, you have the ability to use a management of contexts. Context management is performed on disk: the values of the various variables are stored on the server in a file. A context identifier is used to retrieve the context stored during a next call to the web service. This identifier is stored in a SOAP header on the client computer. This identifier guarantees the security of the data stored.
This operating mode is as follows:
  • The identifier is stored in a SOAP header. When using DeclareWebserviceContext, the WSDL is modified and it indicates that the format accepts a header section with a precise name and a specific format.
  • The client transmits this information.
    • During the first call, the value is empty, the server creates a new session.
    • If the value is missing, the server creates a new session.
  • The server returns the requested information.
To implement a management of contexts:
  1. Use DeclareWebserviceContext to store the desired variables. It is advisable to use this function in the project initialization code (for project variables) and/or in the initialization code of procedure collections or classes. In most cases, this function must be used in the process where the variables are declared and initialized.
    Remarks:
    • The context is always saved on disk and transmitted via a SOAP header.
    • DeclareWebserviceContext uses the contexts on disk. The values of variables are always restored.
    • The total size of values for the different variables is not limited.
    • The DeclareWebserviceContext function can be used for the 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 during a call to a web service can be retrieved during the next call. Variables previously passed are automatically saved again.
    • Simple variables (integer, string, etc.) are supported as well as structure, class, array or associative array variables. Fixed arrays, global class members and associative arrays of local structures are not supported.
  2. To delete a specific variable from the context, you have the ability to use CancelWebserviceContext.
Note WEBDEV administrator can configure the validity period of web service contexts ("Web service context duration" option in the "Configuration" tab). As soon as the specified duration is exceeded, and if no new request was performed, the context file is deleted.

Using an HFSQL database

A SOAP web service can be linked to an analysis and manipulate data files, for example via queries.
Web service structures and classes can be used to describe data files. Here are a few tips:
  • To simply copy a record from an HFSQL data file to a structure or object, use the FileToMemory function.
  • To simply copy the contents of an HFSQL data file into a structure or object, use the FileToArray function.
  • To easily create classes corresponding to database files, use the "Project Explorer" pane:
    1. Select the required data file.
    2. From the context menu, select "Generate template class".
SOAP web service generation
To generate a SOAP web service:
  1. If necessary, select the configuration corresponding to the SOAP web service via the "Project Explorer" pane.
  2. Generate the SOAP web service:
    • On the "Project" tab, in the "Generation" group, click "Generate".
    • Click the generation icon in the quick access buttons.
  3. The SOAP webservice generation wizard is launched.
  4. In the wizard, specify:
    • the name of the web service. By default, the web service name corresponds to the name of the current project. You can change the name of the web service (the project name will not change).
    • the mode for passing parameters to the functions.
      Note: It is advisable to use direct function settings.
  5. Go to the next step.
  6. Select the elements that will be included in the web service. This excludes all UI elements (window, page, report, etc.).
    Check the elements to include and the ones that will be called in the web service. You can:
    • Add elements
      Any type of file can be added to the list of items inserted in the library: images, text files, etc.
    • Delete elements
      The corresponding files and their dependencies will be ignored in the library.
    • Create the web service from an existing description (*.WDU file)
      When creating a WINDEV library, a ".WDU" file with the same name is automatically created. This file contains all the references of the elements included in the library.
  7. Go to the next step.
  8. Check the accessible elements. The accessible elements correspond to the procedures that contain functions visible by the client application that calls the web service.

    Warning If you make a collection of procedures accessible, all global procedures belonging to this collection will be accessible. Two methods can be used to hide some procedures:
    • include these procedures in a specific set and do not make this set accessible.
    • use the word PRIVE to make the procedure inaccessible (syntax: PROCEDURE PRIVE MaProc()). For more details, see Global procedures.
  9. Complete the wizard to generate the SOAP web service.
  10. The deployment wizard automatically opens.
Deploying a web service and running its test

Deploying a web service

To use a web service, it must be deployed on a WEBDEV Application Server.
There are several deployment methods:
  • Deploy web service to a remote WEBDEV Application Server.
  • Deploy web service to the cloud for PC SOFT applications.
  • Deploy web service to PC SOFT test hosting service.
  • Create a remote deployment package.
  • Create installation media.
  • Deploy web service to the local computer.
  • Creating a web service docker image.
The options for deploying a web service and a WEBDEV website are the same. For more details, see Deploying a site.

Special case: Deploying and testing a web service on the local computer

The new web service can be tested directly on the development computer. To do so, select "Deploy web service to the local computer". This option is available only if WEBDEV is installed on the development computer. In this case, the WEBDEV application server is used.
At the end of the setup, a screen appears showing 2 links:
  • a link that indicates the address of the test page of the web service (http://user-pc/MYWEBSERVICE_WEB/awws/index.htm)
  • a link that indicates the address of WSDL (http://user-PC/MYWEBSERVICE_WEB/awws/MyWebservice.awws?wsdl)
Once the link was clicked or the address typed in your browser, an HTML page is displayed: this page contains the accesses to all the functions developed in the web service as well as a link to the WSDL. This page is automatically created when generating the web service as well as all the HTML pages used to run the test of each web service function.
In our example, you will find the access to the "Addition" function:
When you click on a function to test it, a new HTML page is displayed: this page contains fields for entering call parameters for the function under test. In this case, simply fill out the controls and click "Test". A result page will be displayed in return. In our example, two numbers must be passed to the "Addition" function:
The generated result page will be:
The result is in XML format. The return values are encapsulated in XML tags. In our example, the return value of the "Addition" functions is enclosed in the "AdditionResult" tag.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help