我的代码:
winform.cs:其中GetWeb就是引用的一个web serviceprivate void button1_Click(object sender, EventArgs e)
{
string xmlpath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "datatrans.xml"; XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlpath); GetWeb.Service myweb = new GetWeb.Service();
string ss=myweb.getxml(xmlDoc);
lblName.Text = ss;
}xml.asmx:
......
public Service () { //如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}[WebMethod]
public string getxml(XmlDocument xmlg)
{
......
}
......现在的问题是,在函数getxml中参数引用是否有问题?如果没有,那下面的解析应该怎么做呢?如果有问题,应该如何修改?我现在怎么试都不行,唉,郁闷死了,哪位高人帮帮忙啊,谢谢
winform.cs:其中GetWeb就是引用的一个web serviceprivate void button1_Click(object sender, EventArgs e)
{
string xmlpath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "datatrans.xml"; XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlpath); GetWeb.Service myweb = new GetWeb.Service();
string ss=myweb.getxml(xmlDoc);
lblName.Text = ss;
}xml.asmx:
......
public Service () { //如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}[WebMethod]
public string getxml(XmlDocument xmlg)
{
......
}
......现在的问题是,在函数getxml中参数引用是否有问题?如果没有,那下面的解析应该怎么做呢?如果有问题,应该如何修改?我现在怎么试都不行,唉,郁闷死了,哪位高人帮帮忙啊,谢谢
[WebMethod]
public string getxml(System.Xml.XmlDocument xmlg)
{
return xmlg.DocumentElement.Attributes[0].Name.ToString();
}winForm中调用的时候:
string xmlpath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "datatrans.xml";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlpath);
GetWeb.Service myweb = new GetWeb.Service();
string ss = myweb.getxml((System.Xml.XmlDocument)xmlDoc);
lblName.Text = ss;