// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.Web.Services; namespace Ws.Soap1 { public class T1 { public T1() : this(0, "") { } public T1(int f1, string f2) { this.f1 = f1; this.f2 = f2; } public int f1 { get; set; } public string f2 { get; set; } } [WebService(Name="TestService",Namespace="http://soap.ws")] public class Test { [WebMethod] public T1 getOne(int f1) { // dummy implementation return new T1(f1, "getOne"); } [WebMethod] public T1[] getAll() { // dummy implementation T1[] res = new T1[3]; res[0] = new T1(1, "getAll #1"); res[1] = new T1(2, "getAll #2"); res[2] = new T1(3, "getAll #3"); return res; } [WebMethod] public bool save(int f1, string f2) { // dummy implementation return f1 > 0 && f2.Length > 0; } [WebMethod] public bool saveObject(T1 o) { // dummy implementation return o.f1 > 0 && o.f2.Length > 0; } [WebMethod] public bool delete(int f1) { // dummy implementation return f1 > 0; } } }