How to: Define Operations for ASP.NET Web Services
In Application Designer and System Designer, you can define operations for a .NET Web Service provider endpoint. You can perform this task by using the Web Service Details window. For more information, see Overview of ASP.NET Applications on Application Diagrams.
You can create a .NET Web Service provider endpoint with predefined operation signatures and types by specifying a WSDL or .disco file. You can then edit these operations in the Web Service Details window. For more information, see How to: Add Endpoints to Applications.
When you define the operations for a .NET Web Service provider endpoint, you define them for all uses of that endpoint. After you define these operations, you can edit them at any time by using the Web Service Details window. After you implement an ASP.NET application with a .NET Web Service provider endpoint, you can edit the endpoint's operations through the Web Service Details window or through the code, which are kept synchronized. For more information, see How to: Edit Operations for ASP.NET Web Services.
An ASP.NET application project contains a Web service class file for each Web service provider endpoint on the application. Each Web service class file contains the operation signatures for the corresponding Web service provider endpoint. Each operation signature, along with any comments, appears as a method with the WebMethod attribute in the Web service class file. You can add the appropriate method body code to complete the implementation of each operation.
To define a Web service operation
On the diagram, select a Web service provider endpoint.
On the Diagram menu, choose Define Operations.
You can also right-click the endpoint to choose Define Operations.
The Web Service Details window appears.
On the operation row in the Web Service Details window, click <add operation> under Name and name the operation.
On the same row under Type, specify the operation return type, if needed. If you do not need to specify a type, proceed to Step 7.
By default, an operation returns no data unless explicitly defined to do so. The representation of an operation that returns no data depends on the language specified for the Web service. When using Visual Basic, no operation return type is specified. When using Visual C#, the default return type for an operation is void. Interface types cannot be serialized and will generate an error when creating any Web references connected with the Web service.
To select a type, begin typing to view the type list.
As you type, the list opens and displays available types.
If the type you want is not in the type list, use the fully qualified type name, specify a type defined in another project or type library, or specify a new type to define after implementation. To finish specifying the type, continue typing the name of the type you want.
Leave the cell by pressing ENTER or clicking another cell.
Pressing the TAB key replaces the type you specified with the closest matching type in the type list.
Under Summary, add any comments about the operation.
To add more information, click the ellipsis (…) button to open the Description dialog box. You can then specify additional comments for the WSDL description, the operation return type, if any, and other remarks. Any WSDL description information that you specify appears in the WSDL file.
Before you implement an ASP.NET application, the type list displays only those types that are defined in the Microsoft core library (MSCorLib.dll) plus a number of other implicitly referenced type libraries. However, you can reference types defined in other type libraries and projects, or you can reference types that you plan to define at a later time in code or by using Class Designer once the application is implemented.
If you reference types that are defined in other projects or type libraries, you must add references to those projects or libraries once the application is implemented. The type list will include all types that are defined in all explicitly referenced projects and type libraries. For more information, see How to: Add and Remove References in Visual Studio (C#).
If you reference types that you plan to define later, these types do not appear in the type list until you add a class file or class diagram to the application project to define the type once the application is implemented. For more information, see How to: Define Operation and Parameter Types for ASP.NET Web Services.
After you define an operation, you can define its parameters or another operation on the next operation row.
To define parameters for a Web service operation
In the Web Service Details window, expand the operation node.
On the parameter row below the operation, click <add parameter> under Name and name the parameter.
Choose a unique parameter name within the operation.
Under Type, specify the parameter type if needed.
Under Modifier, select how to pass the parameter.
Under Summary, add any comments about the parameter.
To add more information, click the ellipsis (…) button to open the Description dialog box.
After defining a parameter, you can define a new parameter on the next parameter row. You can also define a parameter through its properties in the Properties window.