B
Brock
I'm trying to develop a web service to expose an XML file for product
manufacturers for a client application to consume and populate a
datagrid on the consuming end.
I have successfully tested the web service with simple mathematic
returns like:
<%@ WebService Language="VB" Class="aWebService" %>
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
<WebService(Namespace := "http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class aWebService
Inherits System.Web.Services.WebService
<System.Web.Services.WebMethod()> _
Public Function SquareRootTimesSide(ByVal Diagonal As Double) _
As Double
Return (Diagonal * System.Math.Sqrt(2))
End Function
End Class
So I thought I'd try exposing structured data. I use mostly XML files
for my datasources so I'd like to stick with that.
I have successfully implemented reading the XML file into a
local .aspx page with this code:
<script runat="server">
Private Function MakeDataView() as DataView
Dim myDataSet As New DataSet()
myDataSet.ReadXml(Server.MapPath("Manufacturers.xml"))
Dim view As DataView = New DataView(myDataSet.Tables(0))
view.AllowDelete = False
view.AllowEdit = False
view.AllowNew = False
view.Sort = "name ASC"
Return view
End Function
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim view as DataView = MakeDataView()
dgManufacturers.DataSource = view
dgManufacturers.AllowSorting = True
dgManufacturers.DataBind()
End Sub
</script>
How can I write the server-side code as a web method?
Many thanks!!
Brock
manufacturers for a client application to consume and populate a
datagrid on the consuming end.
I have successfully tested the web service with simple mathematic
returns like:
<%@ WebService Language="VB" Class="aWebService" %>
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
<WebService(Namespace := "http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class aWebService
Inherits System.Web.Services.WebService
<System.Web.Services.WebMethod()> _
Public Function SquareRootTimesSide(ByVal Diagonal As Double) _
As Double
Return (Diagonal * System.Math.Sqrt(2))
End Function
End Class
So I thought I'd try exposing structured data. I use mostly XML files
for my datasources so I'd like to stick with that.
I have successfully implemented reading the XML file into a
local .aspx page with this code:
<script runat="server">
Private Function MakeDataView() as DataView
Dim myDataSet As New DataSet()
myDataSet.ReadXml(Server.MapPath("Manufacturers.xml"))
Dim view As DataView = New DataView(myDataSet.Tables(0))
view.AllowDelete = False
view.AllowEdit = False
view.AllowNew = False
view.Sort = "name ASC"
Return view
End Function
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim view as DataView = MakeDataView()
dgManufacturers.DataSource = view
dgManufacturers.AllowSorting = True
dgManufacturers.DataBind()
End Sub
</script>
How can I write the server-side code as a web method?
Many thanks!!
Brock