PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • How to make a Webservice available?
  • Creating the Webservice
  • Managing contexts
  • Generating the Webservice
  • Deploying a Webservice and running its test
  • Deploying a Webservice
  • Special case: Deploying a Webservice and running its test on the local computer
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
WINDEV and WEBDEV allow you to generate Webservices directly. Then, these Webservices can be used in the WINDEV, WEBDEV, WINDEV Mobile projects or in any other language.
A Webservice 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 webservice will include WLanguage functions organized in sets of procedures. These functions can handle a database (HFSQL, Oracle, AS/400, ...).
Caution: Deploying a WINDEV or WEBDEV Webservice requires the use of a WEBDEV Application Server. Via this distribution mode, the Webservices created with WINDEV/WEBDEV present several types of benefits:
  • Webservices deployed on a WEBDEV Application Server (compatible with all the Web servers).
  • Several modes for deploying the Webservice (physical media, FTP, Cloud).
  • Heavy workload possible.
  • Webservices that can operate on all the Windows versions (32 and 64 bits) as well as in Linux.
How to make a Webservice available?
To make a Webservice available, you must:
  1. Create a Webservice.
  2. Generate a Webservice.
  3. Deploy the Webservice on a WEBDEV Application Server.
Note: To run the test of the Webservice, you have the ability to deploy it locally for test.
Creating the Webservice
To create a Webservice:
  1. Create a WINDEV or WEBDEV project whose type is Webservice or a Webservice configuration in an existing project.
    • When creating a project, select "Webservice".When creating a project, select "SOAP or REST webservice".
    • To create a Webservice project configuration, on the "Project" pane, in the "Project configuration" group, expand "New configuration" and select "Webservice".
  2. Create one or more sets of procedures:
    • In the project explorer, select the "Procedures" folder.
    • Select "New set of procedures" from the popup menu.
  3. Create the global procedures or the functions corresponding to the processes that must be performed on the server.
    // Global Addition procedure
    PROCEDURE Addition(nNumber1 is int, nNumber2 is int)

    nResult is int
    nResult = nNumber1 + nNumber2

    RESULT nResult

    Each global procedure can be run by the WEBDEV Application Server.
    Notes:
    • If the parameters of the procedures have no type, they will be automatically received as Unicode character strings. Therefore, you must specify the type of the parameters that must differ from a Unicode character string.
    • The procedures can be marked as public or private. A public procedure can be used in the projects that will import the Webservice. A private procedure cannot be used in the projects that will import the Webservice (the procedure will not be visible in the project explorer). To mark a procedure as public or private, use the popup menu on the name of the procedure in the project explorer.
    • Versions 16 and later
      The procedures can return classes, structures, arrays of structures or arrays of classes. The returned arrays are limited to one dimension.
      New in version 16
      The procedures can return classes, structures, arrays of structures or arrays of classes. The returned arrays are limited to one dimension.
      The procedures can return classes, structures, arrays of structures or arrays of classes. The returned arrays are limited to one dimension. Caution: The Webservice must have no GUI (no window, report, 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 closing code of project. These two codes will be respectively run when loading and when unloading the library of the Webservice.
Versions 16 and later

Managing contexts

To keep the value of global variables during successive calls to a webservice, you have the ability to use a management of contexts. The management of contexts is performed on disk: the value of the different variables is stored in a file on the server. A context identifier is used to retrieve the context stored during a next call to the webservice. 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 requested variables. We recommend that you use this function in the initialization code of project (for the project variables) and/or in the initialization code of sets of procedures or classes. In most cases, this function must be used in the process where the variables are declared and initialized.
    Notes:
    • The context is always saved on disk and transmitted via a SOAP header.
    • DeclareWebserviceContext is using 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 webservice can be retrieved during the next call. The variables that were passed beforehand are automatically saved again.
    • The simple variables (integer, string, ...) are supported as well as the structure, class, array or associative array variables. The fixed arrays, the global members of classes and the 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: The WEBDEV administrator gives you the ability to configure the duration regarding the validity of webservice contexts ("Duration of webservice contexts" in the "Configuration" tab). As soon as the specified duration is exceeded, and if no new request was performed, the context file is deleted.
New in version 16

Managing contexts

To keep the value of global variables during successive calls to a webservice, you have the ability to use a management of contexts. The management of contexts is performed on disk: the value of the different variables is stored in a file on the server. A context identifier is used to retrieve the context stored during a next call to the webservice. 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 requested variables. We recommend that you use this function in the initialization code of project (for the project variables) and/or in the initialization code of sets of procedures or classes. In most cases, this function must be used in the process where the variables are declared and initialized.
    Notes:
    • The context is always saved on disk and transmitted via a SOAP header.
    • DeclareWebserviceContext is using 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 webservice can be retrieved during the next call. The variables that were passed beforehand are automatically saved again.
    • The simple variables (integer, string, ...) are supported as well as the structure, class, array or associative array variables. The fixed arrays, the global members of classes and the 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: The WEBDEV administrator gives you the ability to configure the duration regarding the validity of webservice contexts ("Duration of webservice contexts" in the "Configuration" tab). As soon as the specified duration is exceeded, and if no new request was performed, the context file is deleted.

Managing contexts

To keep the value of global variables during successive calls to a webservice, you have the ability to use a management of contexts. The management of contexts is performed on disk: the value of the different variables is stored in a file on the server. A context identifier is used to retrieve the context stored during a next call to the webservice. 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 requested variables. We recommend that you use this function in the initialization code of project (for the project variables) and/or in the initialization code of sets of procedures or classes. In most cases, this function must be used in the process where the variables are declared and initialized.
    Notes:
    • The context is always saved on disk and transmitted via a SOAP header.
    • DeclareWebserviceContext is using 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 webservice can be retrieved during the next call. The variables that were passed beforehand are automatically saved again.
    • The simple variables (integer, string, ...) are supported as well as the structure, class, array or associative array variables. The fixed arrays, the global members of classes and the 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: The WEBDEV administrator gives you the ability to configure the duration regarding the validity of webservice contexts ("Duration of webservice contexts" in the "Configuration" tab). As soon as the specified duration is exceeded, and if no new request was performed, the context file is deleted.
Generating the Webservice
To generate a Webservice:
  1. Select "Workshop .. Webservices (SOAP, .Net, J2EE) .. Generate a Webservice from this project".Generate the Webservice:
    • if the current configuration is the one of the Webservice:
      • on the "Project" pane, in the "Generation" group, click "Generate".
      • click the generation icon among the quick access buttons.
    • if the current configuration is not the one of the Webservice: select the requested generation among the quick access buttons:
  2. The wizard for generating the Webservice starts.
  3. Specify:
    • the name of the Webservice. By default, the Webservice name corresponds to the name of the current project.
    • Versions 19 and later
      the mode for passing parameters to the functions.
      Note: We recommend that you use the direct setting of functions.
      New in version 19
      the mode for passing parameters to the functions.
      Note: We recommend that you use the direct setting of functions.
      the mode for passing parameters to the functions.
      Note: We recommend that you use the direct setting of functions.
  4. Go to the next step.
  5. Select the elements that will be included in the Webservice. These elements correspond to anything but the interface elements (window, page, report, ...).
    Check the elements to include and the ones that will be called in the Webservice.
    • You can:
      • Add elements
        Any type of file can be added to the list of elements inserted into the library: images, text files, ...
      • Delete elements
        The corresponding files and their dependencies will be ignored in the library.
      • Create the webservice 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.
  6. Go to the next step.
  7. Check the accessible elements. The accessible elements correspond to the procedures that contain functions visible by the client application that calls the Webservice.

    Caution: If a set of procedures becomes accessible, all the global procedures belonging to this set 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 PRIVATE keyword to make the procedure inaccessible (syntax: PRIVATE PROCEDURE MyProc()). See Global procedures for more details.
  8. At the end of Webservice generation, WINDEV and WEBDEV propose to deploy the Webservice. Two methods are proposed:
    • WEBDEV application server (recommended).
    • "Isapi" mode (using a SOAP server). This method is not recommended. It is kept for backward compatibility with version 14. See the documentation supplied with WINDEV 14 for more details.
    End the wizard to generate the Webservice.
  9. The deployment wizard is automatically started thereafter.
Deploying a Webservice and running its test

Deploying a Webservice

In order to be used, a Webservice must be deployed on a WEBDEV Application Server.
Several deployment methods can be used:
  • Deploying the webservice on a remote WEBDEV application server.
  • Deploying the webservice in the CLOUD for the PC SOFT applications.
  • Deploying the webservice via the test hosting service of PC SOFT.
  • Creating a remote deployment package.
  • Creating a setup by physical media.
  • Deployment of webservice on the local computer.
The options for deploying a Webservice are identical to the options for deploying a WEBDEV site. See Deploying a site for more details.
Versions 16 and later

Special case: Deploying a Webservice and running its test on the local computer

The test of the created Webservice can be run on the developer computer. To do so, select "Deploy the Webservice on the local computer". This type of setup is available only if WEBDEV is available on the development computer. In this case, the application server used is the one of WEBDEV.
At the end of setup, a screen indicating 2 links is displayed:
  • a link that indicates the address of the test page of the webservice (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 Webservice as well as a link to the WSDL. This page is automatically created when generating the Webservice as well as all the HTML pages used to run the test of each Webservice function.
In our example, you will find the access to the "Addition" function:
When you click a function to run its test, a new HTML page is displayed: This page contains controls used to enter the parameters for calling the function whose test is run. In this case, all you have to do is fill the controls and click the "Test" button. 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.
New in version 16

Special case: Deploying a Webservice and running its test on the local computer

The test of the created Webservice can be run on the developer computer. To do so, select "Deploy the Webservice on the local computer". This type of setup is available only if WEBDEV is available on the development computer. In this case, the application server used is the one of WEBDEV.
At the end of setup, a screen indicating 2 links is displayed:
  • a link that indicates the address of the test page of the webservice (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 Webservice as well as a link to the WSDL. This page is automatically created when generating the Webservice as well as all the HTML pages used to run the test of each Webservice function.
In our example, you will find the access to the "Addition" function:
When you click a function to run its test, a new HTML page is displayed: This page contains controls used to enter the parameters for calling the function whose test is run. In this case, all you have to do is fill the controls and click the "Test" button. 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.

Special case: Deploying a Webservice and running its test on the local computer

The test of the created Webservice can be run on the developer computer. To do so, select "Deploy the Webservice on the local computer". This type of setup is available only if WEBDEV is available on the development computer. In this case, the application server used is the one of WEBDEV.
At the end of setup, a screen indicating 2 links is displayed:
  • a link that indicates the address of the test page of the webservice (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 Webservice as well as a link to the WSDL. This page is automatically created when generating the Webservice as well as all the HTML pages used to run the test of each Webservice function.
In our example, you will find the access to the "Addition" function:
When you click a function to run its test, a new HTML page is displayed: This page contains controls used to enter the parameters for calling the function whose test is run. In this case, all you have to do is fill the controls and click the "Test" button. 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 required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment