To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
Returning Structs

Working with SOAP Web Services

Lesson 2: Creating a simple SOAP Web Service in DataFlex

In this lesson, creating a web service in DataFlex will be shown using a previously created workspace called “Cookbook.” This was created in the Data Dictionairies Course.

  1. Open DataFlex as an administrator
  2. From the Worspaces panel on the left select “Cookbook”
  3. To create a project, select FILE > NEW >PROJECT
  4. Select ‘Mobile Web Project’ from the options and press ‘OK’
  5. Name the service, “CookbookWebService,” leave the remaining selections as they appear, and select OK.
  6. To create a new web service class, select FILE > NEW > WEB OBJECT
  7. Select ‘Web Service Object’ from the options and press ‘OK’
  8. Name the object “oWsCookbook,” and select OK thus creating the web service class.
  9. Shown is the psDocumentation that provides the opportunity to enter a description about what the web service does.
  10. For this example, “This is the cookbook webservice” is entered.
  11. Viewing the properties panel (CTRL+2) shows that several other properties that can be set.
  12. Set “psServiceTitle” to “CookbookWs.” This then added to the code.
  13. Next, create a simple method that will return a greeting, publish the function so that it can be called by the service, and add a description…
    {Published = True}

    {Description = “Returns a simple hello message”}

    Function Hello Returns String

          Function_Return “Hello from the other side!”

  14. Select run icon from the top toolbar.
  15. A web browser page will open showing the generated page that shows the web service.
  16. Selecting the “Hello” calls on the Hello function that was just created.
  17. Click on “Invoke,” and the specified string will appear; “Hello from the other side!”
  18. Another example of a function would be to add two numbers.
    {Published = True}

    {Description = “Adds 2 numbers and returns the result”}

    Function AddNumbers Integer 1A Integer 1B Returns Integer

          Function_Return (1A + 1B)


  19. Select run icon from the top toolbar.
  20. The web browser page now shows both functions.
  21. Selecting “AddNumbers” calls the new function.
  22. Enter values in the 1A and 1B fields, select “invoke,” and the result will be shown.