Skip to main content
Previous section   Next section

Creating a Simple Web Service

Here are the steps for creating a Caché Web Service using MVBasic:
  1. Create a Web application definition for the MyAccount namespace. See Web Application Configuration for instructions. Be sure that Inbound Web Services Enabled is selected.
  2. Open Studio. Click File–>Change Namespace and connect to the USER namespace. See the note below for instructions.
  3. Launch the Caché Web Service Wizard. To do this click File–>New. Then click the Custom tab on the New dialog. Click the Web Service icon then click the OK button.
    images/tvqs_wsnewdialog_20142.png
  4. On the first page of the wizard, leave the default values and click OK.
    images/tvqs_webservicewizard1_20112.png
  5. The wizard generates a new class named MyApp.MyService. The class contains a single method named Test. The class looks like this.
    images/tvqs_services1_20101.png
  6. By default the language for the class is ObjectScript. Change the language to MVBasic by changing the value of the
    language
    class parameter to
    mvbasic
    . Do this by modifying the class declaration to look like this.
    
    Class MyApp.MyService Extends %SOAP.WebService
    [ language=mvbasic, ProcedureBlock ]    
    
  7. Next, change the Test method so it uses MVBasic. Replace
    Quit
    with
    Return
    .
    
    Method Test() As %String [ WebMethod ]
    {
      Return "Test"
    }    
    
  8. Compile the class by clicking Build–>Compile from the menu bar.
Note:
Read Opening a File in Studio for instructions on opening Studio, connecting to a namespace, and opening a file.
Previous section   Next section