1

I would like to know how I could consume a WCF service using Visual Basic 6. I created a service and I set up to use custom validation, passing user credentials. Apparently, if I add the service, which is hosted on my local IIS as a Service Reference, I am able to call the methods in my service. To pass the credencials I use the ClientCredentials class, by setting the UserName and Password properties as shown below:

publicServiceClient.ClientCredentials.UserName.UserName = userName;
publicServiceClient.ClientCredentials.UserName.Password = password;

Some guy who will consume my service, do not have experience with C# or Visual Basic.NET, which became to a problem for consume the service, since it is not possible to add the service as a service reference in Visual Basic 6.

Is there anything I can do for help this developer, so that this guy can consume my service using Visual Basic 6? Is there some library, class or third party solution that enable me to pass the credentials for the service? I tried inspecting some calls to the service using Fidler, and the credentials that I passed (using a project that I created as client) are not passed within a header.

Please, if someone can help me I appreciate. I really would rather not change the implementation of my service or configuration.

tom redfern
  • 30,562
  • 14
  • 91
  • 126
TuLePe
  • 41
  • 1
  • 4

1 Answers1

0

It's hard to know from what you've described,

He could possibly use a XMLHTTP request from VB6 if you have a url for your web proxy. I don't know if that's a possibility?

That's for a simple scenario, but if you can create a Visual Studio project with Output Type set to a Class Library project,

Then the VB6 project just needs to add a reference to your publicServiceClient type library.

In his code he can then use Intellisense to get your service properties: Something variation like this might work

Dim o As publicServiceClient.UserService
Dim usr As publicServiceClient.ClientCredentials
Set o = New publicServiceClient.UserService

Set usr = o.UserName(1)
MsgBox usr.UserName & " " & usr.Password

There is an example and some code you can download from http://www.techrepublic.com/article/create-a-proxy-to-consume-net-web-services/#

I don't know if this answers your question, but perhaps it's a helpful start?

dbmitch
  • 5,361
  • 4
  • 24
  • 38