2

我有一种将 xml 作为字符串接收的方法的 web 服务:

[WebMethod]
public int Catch_string(string str)
{  
}

如何从 win 表单将 xml 文件发送到此方法?

为什么它不起作用^

HttpWebRequest req = 
(HttpWebRequest)WebRequest.Create("http://localhost/test/service.asmx");
       req.ContentType = "text/xml;charset=\"utf-8\"";
       req.Accept = "text/xml";
       req.Method = "POST";
       Stream stm = req.GetRequestStream();
       outXml.Save(stm);
       stm.Close();
4

1 回答 1

4

将 webreference 添加到您的 winforms 应用程序并使用生成的代理类来调用 web 服务。

查看此链接以获取实施详细信息。

于 2010-09-21T04:35:56.563 回答