views:

20

answers:

1

Please forgive any mistakes in this question. I am not overly familiar with secure web services or WCF.

I need to consume a web service that uses WSE 2.0 and .Net 1.1.

The service is secured in two ways. An X509Certificate and a BinarySecurityToken added to the header.

I have code samples as to how to consume this Web Service when using Visual Studio 2003 and WSE 2.0.

My main question is should I be attempting to consume this Web Service using a "Web Reference" or a "Service Reference"?

The code samples I have use the binary 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.

+1  A: 

If you want to use WCF for your client you have to use Add service reference. If you use Add web reference only works for ASMX services. 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.

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.

You can also check these two articles related to WCF <-> WSE 3.0 interoperatbility: Migrating WSE 3.0, Interoperability with WSE 3.0.

Ladislav Mrnka