SimpleWebService.aspx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <%@ Page Language="C#" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head id="Head1" runat="server">
  5. <style type="text/css">
  6. body { font: 11pt Trebuchet MS;
  7. font-color: #000000;
  8. padding-top: 72px;
  9. text-align: center }
  10. .text { font: 8pt Trebuchet MS }
  11. </style>
  12. <title>Simple Web Service</title>
  13. <script type="text/javascript">
  14. // This function calls the Web Service method.
  15. function EchoUserInput()
  16. {
  17. var echoElem = document.getElementById("EnteredValue");
  18. Samples.AspNet.SimpleWebService.EchoInput(echoElem.value,
  19. SucceededCallback);
  20. }
  21. // This is the callback function that
  22. // processes the Web Service return value.
  23. function SucceededCallback(result)
  24. {
  25. var RsltElem = document.getElementById("Results");
  26. RsltElem.innerHTML = result;
  27. }
  28. </script>
  29. </head>
  30. <body>
  31. <form id="Form1" runat="server">
  32. <asp:ScriptManager runat="server" ID="scriptManager">
  33. <Services>
  34. <asp:ServiceReference path="SimpleWebService.asmx" />
  35. </Services>
  36. </asp:ScriptManager>
  37. <div>
  38. <h2>Simple Web Service</h2>
  39. <p>Calling a simple service that echoes the user's input and
  40. returns the current server time.</p>
  41. <input id="EnteredValue" type="text" />
  42. <input id="EchoButton" type="button"
  43. value="Echo" onclick="EchoUserInput()" />
  44. </div>
  45. </form>
  46. <hr/>
  47. <div>
  48. <span id="Results"></span>
  49. </div>
  50. </body>
  51. </html>