WebMethod (Query Keyword)
Usage
To specify that this query is a web method, use the following syntax:
Query name(formal_spec) As classname [ WebMethod ] { //implementation }
Otherwise, omit this keyword or place the word Not immediately before the keyword.
Details
This keyword specifies whether this class query is a web method and can be invoked via the SOAP protocol.
For requirements for a web method, see Creating Web Services and Web Clients.
Default
If you omit this keyword, the query cannot be invoked as a web method.
Generated Class
When you add this keyword to a class query and compile the class, the class compiler generates two additional classes:
-
Package.OriginalClass.QueryName
-
Package.OriginalClass.QueryName.DS
Where Package.OriginalClass is the class that contains the web method, and QueryName is the name of class query.
For example, suppose that you start with the class ROBJDemo.QueryWS and you add a class query to it named MyQuery. When you add the WebMethod keyword to that class query and compile it, the class compiler generates the following additional classes:
-
ROBJDemo.QueryWS.MyQuery
-
ROBJDemo.QueryWS.MyQuery.DS
Do not modify or directly use these generated classes; they are is intended only for internal use.
Relationship to WSDL
For a web service, this keyword also affects the generated WSDL, which now contains the additional elements needed to represent this web method.