Guest User

WS-test-mono

a guest
Mar 14th, 2011
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. // SampleData.cs
  2.  
  3. using System;
  4. namespace wsmono
  5. {
  6.     public class SampleData
  7.     {
  8.         public DateTime dateField;
  9.         public String stringField;
  10.         public double doubleField;
  11.         public int intField;
  12.        
  13.         public SampleData ()
  14.         {
  15.             this.dateField = DateTime.Now;
  16.             this.stringField = "Some string";
  17.             Random r = new Random();
  18.             this.doubleField = r.NextDouble();
  19.             this.intField = r.Next();
  20.         }
  21.     }
  22. }
  23.  
  24. /**********************************************************/
  25.  
  26. // WebService1.asmx
  27.  
  28. <%@ WebService Language="C#" Class="wsmono.WebService1" %>
  29.  
  30. using System;
  31. using System.Web.Services;
  32.  
  33. namespace wsmono
  34. {
  35.    
  36.     [WebService(Namespace="http://test.asmody.me/")]
  37.     public class WebService1
  38.     {
  39.         [WebMethod()]
  40.         public String hello(String name)
  41.         {
  42.             return "Hello, "+name;
  43.         }
  44.        
  45.         [WebMethod()]
  46.         public SampleData oneObject()
  47.         {
  48.             SampleData sd = new SampleData();
  49.             return sd;
  50.         }
  51.        
  52.         [WebMethod()]
  53.         public SampleData[] manyObjects(int howMany)
  54.         {
  55.             SampleData[] ar = new SampleData[howMany];
  56.             for(int i=0; i<howMany; i++)
  57.             {
  58.                 ar[i] = new SampleData();
  59.             }
  60.             return ar;
  61.         }
  62.     }
  63. }
  64. /****************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment