bemærk det er nasty! men sådan:
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
[WebService(Namespace = "
http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {}
[WebMethod]
public CustomizedInt HelloWorld() {
return new CustomizedInt(123);
}
}
[XmlRoot("abc", Namespace="")]
public class CustomizedInt : IXmlSerializable
{
private int i=100;
public CustomizedInt() {}
public CustomizedInt(int i) {this.i = i;}
public void WriteXml(System.Xml.XmlWriter writer) {writer.WriteString(i.ToString());}
public System.Xml.Schema.XmlSchema GetSchema(){return null;}
public void ReadXml(System.Xml.XmlReader reader) { }
}