Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SampleData.cs
- using System;
- namespace wsmono
- {
- public class SampleData
- {
- public DateTime dateField;
- public String stringField;
- public double doubleField;
- public int intField;
- public SampleData ()
- {
- this.dateField = DateTime.Now;
- this.stringField = "Some string";
- Random r = new Random();
- this.doubleField = r.NextDouble();
- this.intField = r.Next();
- }
- }
- }
- /**********************************************************/
- // WebService1.asmx
- <%@ WebService Language="C#" Class="wsmono.WebService1" %>
- using System;
- using System.Web.Services;
- namespace wsmono
- {
- [WebService(Namespace="http://test.asmody.me/")]
- public class WebService1
- {
- [WebMethod()]
- public String hello(String name)
- {
- return "Hello, "+name;
- }
- [WebMethod()]
- public SampleData oneObject()
- {
- SampleData sd = new SampleData();
- return sd;
- }
- [WebMethod()]
- public SampleData[] manyObjects(int howMany)
- {
- SampleData[] ar = new SampleData[howMany];
- for(int i=0; i<howMany; i++)
- {
- ar[i] = new SampleData();
- }
- return ar;
- }
- }
- }
- /****************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment