110,535
社区成员
发帖
与我相关
我的任务
分享
[WebMethod]
[return: XmlElement(ElementName = "myResult")]
public string HelloWorld([XmlElement(ElementName = "myHwa")]HWA a, HWB b)
{
//XmlQualifiedName code = new XmlQualifiedName("Client.AuthenticationFailure", "http://schemas.xmlsoap.org/soap/envelope/");
//SoapException ex = new SoapException("this is error", code, "this is action");
//throw ex;
return ((int)a.field + (int)b.field).ToString();
}
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld(HWA a, HWB b)
{
//XmlQualifiedName code = new XmlQualifiedName("Client.AuthenticationFailure", "http://schemas.xmlsoap.org/soap/envelope/");
//SoapException ex = new SoapException("this is error", code, "this is action");
//throw ex;
return ((int)a.field + (int)b.field).ToString();
}
}
public class HWA
{
public Field field;
[XmlType(Namespace = "http://tempuri.org/HWA")]
[XmlRoot(Namespace = "http://tempuri.org/HWA")]
public enum Field
{
aaa,
bbb,
ccc
}
}
public class HWB
{
public Field field;
[XmlType(Namespace = "http://tempuri.org/HWB")]
[XmlRoot(Namespace = "http://tempuri.org/HWB")]
public enum Field
{
a111,
a222,
a333
}
}
参考:
http://msdn.microsoft.com/en-us/magazine/cc164122.aspx