This documentation is archived and is not being maintained.

How to: Group Related Information into a Single Web Service Method

This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation .

The following code example demonstrates how to group related information into a single Web service method. This example illustrates one of the guidelines explained in the topic, Design Guidelines for XML Web Services Created Using ASP.NET.


<%@ WebService Language="VB" Class="DataService" %>
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Services
Public Class DataService   
    <WebMethod> _
    Public Function GetTitleAuthors() As DataSet
        Dim myConnection As New SqlConnection("Persist Security Info=False;Integrated Security=SSPI;server=localhost;database=pubs")
        Dim myCommand1 As New SqlDataAdapter("select * from Authors", myConnection)
        Dim myCommand2 As New SqlDataAdapter("select * from Titles", myConnection)
        Dim ds As New DataSet()
        myCommand1.Fill(ds, "Authors")
        myCommand2.Fill(ds, "Titles")
        Return ds
    End Function
End Class

See Also