以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 EAI/SOA基础与技术 』  (http://bbs.xml.org.cn/list.asp?boardid=73)
----  急问:关于web service引用的问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=73&rootid=&id=58187)


--  作者:yx_think
--  发布时间:1/18/2008 2:28:00 PM

--  急问:关于web service引用的问题
最近刚刚学习web service,在vs2005下,服务端编写代码如下:
添加引用:
using Microsoft.Web.Services2.Attachments;
using System.Web.Services;

添加一个方法:
[WebMethod]
    public void GetFile()
    {

       Attachment  dimeFile = new Attachment("text/plain","D:\\encryText.txt");
       
       Microsoft.Web.Services2.SoapContext
          myContext=Microsoft.Web.Services2.ResponseSoapContext.Current;
        myContext.Attachments.Add(dimeFile );  

    }

客户端,建一个winform 工程:

添加引用:
using Microsoft.Web.Services2.Attachments;
using System.Web.Services;
添加web引用,命名: wsetest4;

添加方法:
void GetSerFile()
{
wsetest4.Service serv;
serv = new WindowsApplication2__key.wsetest4.Service();
serv.GetFile();
}

运行时报错:
客户端发现响应内容类型为“application/dime”,但应该是“text/xml”。这是怎么回事?
哪位高手指点小妹一下,感谢ing。


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
2,545.898ms