Specifies whether this class query is a web method. Applies only in a class that is defined as a web service or web client.
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:
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:
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.