Question

I'm using NSIS to build an installer and as part of that installer I get the details for a WCF Service (i.e. Url, User Name and Password). I need to validate these details.

In C# I create a Service Reference and simply do the following:

var proxy = new ServiceClient(httpsBinding, serviceEndpointAddress);
proxy.ClientCredentials.UserName.UserName = userName;
proxy.ClientCredentials.UserName.Password = password;

try
{
    proxy.Open();
}
catch (EndpointNotFoundException ex)
{
    // Return the end point's not valid
}
etc

Now I need to do this in C++ so it can be called from NSIS (I've investigated methods of calling C# from NSIS and they all seem to be overkill for what I want to do). I've managed to convert the code that generates the binding and the end point address however I'm stuck on creating the ServiceClient.

I've added a "Web Reference" to the project but there's not the equivalent of ServiceClient in the ServiceReference namespace. This:

ServiceReference::ServiceClient ^service = gcnew ServiceReference::ServiceClient(httpsBinding, endpointAddress);

doesn't compile as:

'ServiceClient': is not a member of 'ServiceReference'

So how do I create the client?

Was it helpful?

Solution 3

In the end I went with using the NSIS "Call .NET DLL methods plugin" which was really overkill for what I needed to do, but I needed a solution that worked and I ran out of time.

OTHER TIPS

have you tried gSOAP?

http://gsoap2.sourceforge.net/

that's what we're using to access WS* from C++ programs.

you can make a nice work around, Create a C# DLL, use regasm to register this DLL, then you can use it from your C++ program.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top