简体   繁体   English

使用.Net 3.5和VS 2008消费安全的WSE2.0 / .Net 1.1 WebService

[英]Consuming a secure WSE2.0 / .Net 1.1 WebService using .Net 3.5 and VS 2008

Please forgive any mistakes in this question. 请原谅这个问题的任何错误。 I am not overly familiar with secure web services or WCF. 我对安全的Web服务或WCF不太熟悉。

I need to consume a web service that uses WSE 2.0 and .Net 1.1. 我需要使用一个使用WSE 2.0和.Net 1.1的Web服务。

The service is secured in two ways. 该服务有两种保护方式。 An X509Certificate and a BinarySecurityToken added to the header. X509Certificate和BinarySecurityToken添加到标头。

I have code samples as to how to consume this Web Service when using Visual Studio 2003 and WSE 2.0. 我有一些代码示例,说明如何在使用Visual Studio 2003和WSE 2.0时使用此Web服务。

My main question is should I be attempting to consume this Web Service using a "Web Reference" or a "Service Reference"? 我的主要问题是我是否应该尝试使用“ Web参考”或“服务参考”使用此Web服务?

The code samples I have use the binary Microsoft.Web.Services2. 我使用的代码示例使用二进制Microsoft.Web.Services2。 I am looking for the equivalent classes / methods that will allow me to perform the same functionality. 我正在寻找使我能够执行相同功能的等效类/方法。

The two key lines of code I'm looking to replace are: 我要替换的两行关键代码是:

webService.ClientCertificates.Add(X509Certificate.CreateFromFile(fileName));

and

SoapContext context = webService.RequestSoapContext;
context.Security.Tokens.Add(binarySecurityToken);

Can anyone provide me some information as to which classes I should be looking at or any helpful articles that will help me understand this further? 谁能给我一些信息,让我了解应该参加哪些课程,或者有什么有用的文章可以帮助我进一步理解这一点?

EDIT: To add to this, the method I am struggling to find an alternative to is: 编辑:要补充一点,我正在努力寻找替代方法是:

webService.RequestSoapContext;

I have found various alternative classes / methods in creating the security tokens however, without the RequestSoapContext I do not know where to add them. 我在创建安全令牌时发现了各种替代类/方法,但是没有RequestSoapContext我不知道在哪里添加它们。

If you want to use WCF for your client you have to use Add service reference. 如果要为客户端使用WCF,则必须使用“添加服务参考”。 If you use Add web reference only works for ASMX services. 如果使用添加Web参考,则仅适用于ASMX服务。 I guess WSE extensions are not supported in VS 2008 so you can't create WSE proxy from UI but if you install them you will have some command line tools and you will still be able to use it in .NET 3.5 project. 我猜想VS 2008不支持WSE扩展,因此您不能从UI创建WSE代理,但是如果安装它们,您将拥有一些命令行工具,并且仍然可以在.NET 3.5项目中使用它。

If you need to discuss equivalent WCF binding for WSE service you will have to provide more information - there should be some configuration (in code or config) setting some policy for WSE service. 如果您需要讨论WSE服务的等效WCF绑定,则必须提供更多信息-应该有一些配置(以代码或配置方式)为WSE服务设置了一些策略。

You can also check these two articles related to WCF <-> WSE 3.0 interoperatbility: Migrating WSE 3.0 , Interoperability with WSE 3.0 . 您还可以检查与WCF <-> WSE 3.0互操作性相关的这两篇文章: 迁移WSE 3.0与WSE 3.0的互操作性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM