Creating a Simple Web Service
Here are the steps for creating a Caché Web Service using MVBasic:
-
Create a Web application definition for the MyAccount namespace. See Web Application Configuration for instructions. Be sure that Inbound Web Services Enabled is selected.
-
Open Studio. Click File–>Change Namespace and connect to the USER namespace. See the note below for instructions.
-
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.
-
On the first page of the wizard, leave the default values and click OK.
-
The wizard generates a new class named MyApp.MyService. The class contains a single method named Test. The class looks like this.
-
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 ]
-
Next, change the Test method so it uses MVBasic. Replace Quit with Return.
Method Test() As %String [ WebMethod ] { Return "Test" }
-
Compile the class by clicking Build–>Compile from the menu bar.
Read Opening a File in Studio for instructions on opening Studio, connecting to a namespace, and opening a file.