First create a proxy with the following command: wsdl /l:VB /namespace:TYASPNET.Clients http://localhost/tyaspnet21days/day16/ConvertUnits.asmx?WSDL Compile the proxy with the following command: vbc /t:library /out:..\..\bin\TYASPNET.Clients.ConvertUnits.dll /r:System.dll /r:System.Data.dll /r:System.Web.dll /r:System.Web.Services.dll /r:System.Xml.dll ConvertUnits.vb Then build the ASP.NET page: 1: <%@ Page Language="VB" %> 2: 3: <script runat="server"> 4: sub Submit(Sender as Object, e as EventArgs) 5: dim objService as new TYASPNET.Clients.ConvertUnits 6: dim dblResult as double 7: 8: dblResult = objService.Convert(tbValue.Text, _ 9: lbUnitsFrom.SelectedItem.Text, _ 10: lbUnitsTo.SelectedItem.Text) 11: 12: lblMessage.Text = tbValue.Text & " " & _ 13: lbUnitsFrom.SelectedItem.Text & " = " & _ 14: dblResult & " " & lbUnitsTo.SelectedItem.Text 15: end sub 16: </script> 17: 18: <html><body> 19: <form runat="server"> 20: Convert: 21: <asp:TextBox runat="server" /> 22: <asp:ListBox runat="server" 23: Size="1"> 24: <asp:ListItem>mm</asp:ListItem> 25: <asp:ListItem>cm</asp:ListItem> 26: <asp:ListItem>m</asp:ListItem> 27: <asp:ListItem>km</asp:ListItem> 28: <asp:ListItem>in</asp:ListItem> 29: <asp:ListItem>ft</asp:ListItem> 30: <asp:ListItem>yd</asp:ListItem> 31: <asp:ListItem>mi</asp:ListItem> 32: </asp:ListBox> 33: to: 34: <asp:ListBox runat="server" 35: Size="1"> 36: <asp:ListItem>mm</asp:ListItem> 37: <asp:ListItem>cm</asp:ListItem> 38: <asp:ListItem>m</asp:ListItem> 39: <asp:ListItem>km</asp:ListItem> 40: <asp:ListItem>in</asp:ListItem> 41: <asp:ListItem>ft</asp:ListItem> 42: <asp:ListItem>yd</asp:ListItem> 43: <asp:ListItem>mi</asp:ListItem> 44: </asp:ListBox><p> 45: 46: <asp:Button runat="server" 47: Text="Submit" 48: OnClick="Submit" /><p> 49: <asp:Label runat="server" /> 50: </form> 51: </body></html> |