Skip to main content

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.

    generated description: wsnewdialog 20142

  4. On the first page of the wizard, leave the default values and click OK.

    generated description: webservicewizard1 20112

  5. The wizard generates a new class named MyApp.MyService. The class contains a single method named Test. The class looks like this.

    generated description: services1 20101

  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.

FeedbackOpens in a new tab