Chr*_*isF 14 c++ webservice-client
我正在使用NSIS构建安装程序,作为该安装程序的一部分,我获得了WCF服务的详细信息(即Url,用户名和密码).我需要验证这些细节.
在C#中,我创建了一个服务引用,并简单地执行以下操作:
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
Run Code Online (Sandbox Code Playgroud)
现在我需要在C++中执行此操作,因此可以从NSIS调用它(我已经研究过从NSIS调用C#的方法,它们对于我想做的事情似乎都有点过分).我已经设法转换生成绑定和终点地址的代码但是我坚持创建ServiceClient.
我已经为项目添加了"Web引用",但是ServiceClient在ServiceReference命名空间中没有相应的内容.这个:
ServiceReference::ServiceClient ^service = gcnew ServiceReference::ServiceClient(httpsBinding, endpointAddress);
Run Code Online (Sandbox Code Playgroud)
不编译为:
'ServiceClient':不是'ServiceReference'的成员
那么我该如何创建客户端呢?