我是WSE和WCF的新手,我正在尝试使用WCF使用Web服务,但所有示例文档都适用于VS2005 + WSE.此Web服务使用WS-Security 1.0.我已经通过visual studio添加了一个服务引用,但我不知道如何在WCF中执行以下代码的等效操作:
// 1. Initialize the web service proxy
PartnerAPIWse integrationFramework = new PartnerAPIWse();
// 2. Set the username/password. This is using the Username token of WS-Security 1.0
UsernameTokenProvider utp = new UsernameTokenProvider("username", "password");
integrationFramework.SetClientCredential<UsernameToken>(utp.GetToken());
// 3. Declare the policy
Policy policy = new Policy(new UsernameOverTransportAssertion());
integrationFramework.SetPolicy(policy);
Run Code Online (Sandbox Code Playgroud)