在客户端使用 WCF 可扩展性 [英] Using WCF Extensibility at Client Side

查看:33
本文介绍了在客户端使用 WCF 可扩展性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Web 应用程序作为客户端来使用代理调用 WCF 方法.

I am using a web application as a client to invoke WCF methods using proxy.

对于客户端对象发出的每个请求,我需要填充一些属性(在请求类中声明)是否可以在进行实际 Web 服务调用之前挂钩方法.

For each request being made by client object, I need to populate few properties (declared inside request class) Is it possible to hook a method, just before making the actual web service call.

我现在无法修改服务代码,在这种情况下可以利用 WCF 扩展点吗?

I can't modify service code right now, Can WCF extensibility points could be leveraged in this case?

感谢您的帮助.

推荐答案

如果你想改变方法的属性参数,你可以使用一个IParameterInspector来做那个,因为那时你会得到一个包含所有要发送到服务器的参数的数组.

If you want to change the properties of the method parameters, you can use an IParameterInspector to do that, since at that point you'll get an array with all parameters to be sent to the server.

如果您需要更改请求的其他部分(例如传输或 SOAP 标头),IClientMessageInspector 可能是最好的方法.

If you need to change other parts of the request (such as transport or SOAP headers), an IClientMessageInspector may be the best way to go.

有关客户端的许多扩展点的更多信息,您可以查看位于 http://blogs.msdn.com/b/carlosfigueira/archive/2011/03/14/wcf-extensibility.aspx.

For more information on many extensibility points at the client side, you can check the blog series at http://blogs.msdn.com/b/carlosfigueira/archive/2011/03/14/wcf-extensibility.aspx.

这篇关于在客户端使用 WCF 可扩展性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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