当前位置: 代码迷 >> Web Service >> 请问 这个web service如何使用
  详细解决方案

请问 这个web service如何使用

热度:236   发布时间:2016-05-02 02:56:06.0
请教 这个web service怎么使用?
应用在这里http://www.webxml.com.cn/WebServices/ChinaStockWebService.asmx
其中getStockImageByteByCode ,返回是void
提供的例子是:
字节流到图片可以参考以下方法(.NET vb):
HttpContext.Current.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache) '不缓存
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "image/Gif"
HttpContext.Current.Response.BinaryWrite(Ary) 'Ary 图片字节数组
HttpContext.Current.Response.End()

这个好象要在asp.net里才能实现,怎么在C#的应用程序里实现呢?

求教

------解决方案--------------------
感覺該Service應該返回的是個圖片
http://www.webxml.com.cn/WebServices/ChinaStockWebService.asmx/getStockImageByCode?theStockCode=000709
你應該是直接將你的返回頁面關聯到上面的地址,帶參數的地址。可以試試看!
------解决方案--------------------
参考:
http://dev.csdn.net/article/16/16406.shtm
------解决方案--------------------
WEB SERVICE可以生成Dll应用到应用程序中使用;
也可直接在web应用中添加使用;
------解决方案--------------------
引用楼主 dz08039 的帖子:
应用在这里http://www.webxml.com.cn/WebServices/ChinaStockWebService.asmx
其中getStockImageByteByCode ,返回是void
提供的例子是:
字节流到图片可以参考以下方法(.NET vb):
HttpContext.Current.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache) '不缓存
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "image/Gif"
HttpContext.Current.…

------解决方案--------------------
这个 Web 服务方法,就是相当于提供一个 HTTP 的图像下载。
------解决方案--------------------
添加web引用,然后就可以用了

stock.ChinaStockWebService wsstock=new stock.ChinaStockWebService();
byte[] btimg=wsstock.getStockImageByteByCode("sh600115");
------解决方案--------------------
沉了,帮顶一下
------解决方案--------------------
不是asp.net,而是wse2.0
这个代码是用wse2.0来传输图片等大文件用的。
------解决方案--------------------
安装wse2.0后,
把你的webservice在客户端的代理类的继承改一下:
System.Web.Services.Protocols.SoapHttpClientProtocol
->
Microsoft.Web.Services2.WebServicesClientProtocol

然后在你的客户端代理类的代码里,就可以使用HttpContext.Current.Response来接收附件了。
------解决方案--------------------
注意,getStockImageByteByCode ,返回是void,图片文件就是放在附件当中
wse2.0中集成了mime协议,对类似于邮件的附件传输的支持,可以满足。
当然后来到了wse3.0后,microsoft放弃了wse2.0中的做法,这个可以参考wse3.0.
------解决方案--------------------
探讨
添加web引用,然后就可以用了

stock.ChinaStockWebService wsstock=new stock.ChinaStockWebService();
byte[] btimg=wsstock.getStockImageByteByCode("sh600115");
  相关解决方案