Tag: wse

使用UserNameOverTransport绑定时,如何让WCF以摘要模式发送密码? (将WSE3.0代码转换为WCF)

我正在尝试将此WSE3.0代码转换为WCF: // we use Microsoft WSE 3.0 to insert the username token in the soap header. // This strategy takes care of creating and inserting the Nonce and Created elements // for us, as well as creating a password digest based on Nonce, Created, and // the password itself. Refer to the WS-Secutiry UsernameToken Profile […]

WebServicesClientProtocol在安全标头中将EncodingType添加到Nonce

类似的问题: 如何在WSE 3.0(.NET)中的UsernameToken的Nonce元素中添加EncodingType属性 我正在尝试修改由WebServicesClientProtocol发送到服务的标头。 不幸的是,Microsoft的WSSE Username and Token Security Spec 1.1的实现与标准不兼容,并且没有使用Nonce发送EncodingType 。 在类似的问题我已经链接在顶部解决方案是禁用服务器上的EncodingTypevalidation,但我无法修改任何东西。 我已经将WSDL导入为Web Reference,我已将基类更改为WebServicesClientProtocol 然后在我的代码里面我这样做: var client = new QueryClient(); SoapContext requestContext = client.RequestSoapContext; requestContext.Security.Timestamp.TtlInSeconds = 60; var userToken = new UsernameToken(_userName, _password, PasswordOption.SendHashed); requestContext.Security.Tokens.Add(userToken); X509SecurityToken signatureToken = GetSecurityToken(); requestContext.Security.Tokens.Add(signatureToken); MessageSignature sig = new MessageSignature(signatureToken); requestContext.Security.Elements.Add(sig); client.SetClientCredential(signatureToken); client.SetClientCredential(new UsernameToken(_userName, _password, PasswordOption.SendHashed)); 这创建了几乎理想的请求,但Nonce没有得到EncodingType : ws_test_user […]

(尝试)从WSE 3.0迁移到WCF以获取客户端代码

为此我一直都在网上。 我刚刚做了一段时间的恶魔,我试图消费的网络服务供应商拒绝正式支持WCF作为消费方法。 我不是网络服务专家,所以我会尽力记录和解释这篇文章,但无论如何,如果你需要的话,请求更多的信息,希望我能够提供任何必要的东西。 服务 在我的公司,我们使用公开服务的供应商应用程序。 应用程序是用java编写的,看起来wsdl是用Apache Axis 1.2创建的。 代码 我的遗留代码使用WSE 3.0。 特别是,它使用最后自动添加“WSE”的代理类。 这允许我使用更简单的身份validation方案(我可以使它工作的唯一方法)。 我不需要使用证书。 我使用SecurityPolicyAssertion的衍生物,并将其包装在一个Policy对象中,该对象被传递给客户端类的SetPolicy方法。 以下是创建客户端工作实例所需的全部内容: MyWebServiceWse api = new MyWebServiceWse(); api.Url = myUrl; api.SetPolicy(new Policy(new MyDerivedSecurityAssertion(user, pass))); 我的默认,开箱即用的WCF代码(使用服务引用生成)不接受凭据,所以我知道现在有一个问题。 我在网上阅读了有关在app.config使用不同security或绑定设置的各种内容,但没有任何内容完全奏效。 在大量修补之后我最常见的错误是WSDoAllReceiver: Request does not contain required Security header 。 这是app.config。 也许我们可以先告诉我这里应该改变什么来促进传递证书 – 再次,我在网上看到了不同的意见。 我已经改变了一些属性来模糊我们正在使用的特定服务(公司政策和所有这些)。 这是目前为止的示例C#代码(在控制台应用程序中测试): MyClient client = new MyClient(); client.listMethod(); UPDATE 阅读此SOpost: wcf security。 […]