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:
Calling SOAP Web Services the basics
Cancel

Working with SOAP Web Services

Lesson 4: Structs as parameters

Continuing from the last lesson, a new function will be added that takes a struct as a parameter.

  1. Starting again from WsCookbook.wo…
  2. Add a new function that will ultimately add recipes to the existing “Recipe” table. Make sure publish the function, and to add a description. Include code to validate the data. Add a new struct at the top of the code as well.
    {Published = True}

    {Description = “Adds a new recipe to the cookbook”}

    Function AddNewREcipe tRecipeIn oRecipe Returns Boolean

          Boolean bErr


          Send Clear of oRecipe_DD

          Set Field_Changed_Value of oRecipe_DD Field Recipe.Name to oRecipe.sName

          Set Field_Changed_Value of oRecipe_DD Field Recipe.Name to oRecipe.sName

          Set Field_Changed_Value of oRecipe_DD Field Recipe.Name to oRecipe.sName

          Set Field_Changed_Value of oRecipe_DD Field Recipe.Name to oRecipe.sName


          Get Request_Validate of oRecipe_DD to bErr


          If (not(bErr)) Begin

                Send Request_Save of oRecipeDD

                Function_Return True

          End


          Function_Return False


    End_Function



  3. Add a new struct at the top of the code as well.
    Struct tRecipeIn

          String sName

          Integer iKitchenID

          String sHowToMake

          Integer iPrepTime

    End_Struct



  4. Select run icon from the top toolbar.
  5. The web browser page now shows all four functions.
  6. Selecting “AddNewRecipe” calls the new function.
  7. The resulting page will state that we cannot test this. Continue on to Lesson 5, Calling SOAP WebServices – the basics, of this series to learn how to call on a web service, and how to call on this specific function from the DataFlex program.