Silverlight中的动态服务参考 [英] Dynamic service reference in Silverlight

查看:114
本文介绍了Silverlight中的动态服务参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个与SharePoint Web Services接口的Silverlight应用程序.在Windows窗体应用程序中,我将创建对本地SharePoint服务器的Web引用,然后在运行时更改引用的Uri以指向要使用的任何SharePoint网站. Silverlight似乎没有Web参考,但是可以通过服务参考实现类似的功能.但是,似乎没有办法在运行时更改引用的Uri.有没有办法在Silverlight中做到这一点?还是使用Silverlight中的SharePoint Web Services的更好方法?

I'm building a Silverlight application that interfaces with SharePoint Web Services. In a windows forms application I'd create a web reference to my local SharePoint server, then change the Uri of the reference at runtime to point to whatever SharePoint site I wanted to use. Silverlight doesn't seem to have web references, but similar functionality can be achieved with service references. However, there doesn't seem to be a way to change the Uri of the reference at runtime. Is there a way to do this in Silverlight? Or a better way of using SharePoint web Services from Silverlight?

注意:我需要访问列表项的附件,所以owssvr.dll不够用(我认为呢?)

Note: I need to access list item attachments, so owssvr.dll won't be sufficient (I think?)

推荐答案

看到您正在使用WCF(引用服务)时,可以像下面这样更改服务的地址:

Seeing as you are using WCF (to reference the Service), you can change the Address of the service like so:

MyServiceSoapClient soapClient = new MyServiceSoapClient();
mySoapClient.Endpoint.Address = new EndpointAddress(URI]);
// do call here 

这篇关于Silverlight中的动态服务参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆