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?
using namespace ServiceMainNamespace
directive relative to the web service you added ? – ConsignorServiceClient
you must put a using directive. As in C# ! – ConsignorServiceReference::Service
but that doesn't have any of the methods I'm expecting. – Hurrah