使用 ASP.NET 3.5 中的 ASMX 文件的 WS-Security [英] WS-Security using the ASMX file in ASP.NET 3.5

查看:30
本文介绍了使用 ASP.NET 3.5 中的 ASMX 文件的 WS-Security的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我需要设置我的 ASMX 文件,以便当我在浏览器中拉出它以显示 WebMethod 规范时,Soap Header 符合以下格式:

Basically I need to setup my ASMX file so that when I pull it up in a browser to display the WebMethod specification the Soap Header conforms to this format:

<soap:Header>
   <wsse:Security>
      <wsse:UsernameToken wsu:Id='SecurityToken-securityToken'>
         <wsse:Username>Username</wsse:Username>
         <wsse:Password>Password</wsse:Password>
         <wsu:Created>Timestamp</wsu:Created>
      </wsse:UsernameToken>
   </wsse:Security>
</soap:Header>

背景故事:我正在与一个已经构建(并且归另一家公司所有)的客户端应用程序集成.基本上,这个客户端应用程序已经从它过去与其他公司的集成中设置了它们的soap消息.因此,我们选择仅使用 ASMX 文件构建 Web 服务,该文件与他们已设置使用的 WSDL 相匹配.

Back-story: I'm integrating with a client application that is already built (and owned by another company). Basically this client application already has their soap messages all set up from its past integrations with other companies. So we've opted to just build a web service using an ASMX file that matches the WSDL that they're already setup to consume.

是否可以让 WS-Security 处理 ASMX 文件,还是 ASMX 过于简单而我必须升级到 WFC(我真的不想这样做)?

Is it possible to get WS-Security working on an ASMX file or is ASMX too simplistic and I have to upgrade to WFC (which I really don't want to do)?

推荐答案

您可以使用经典 Web 服务实现 SOAP/WS-Security 服务.这是来自 MSDN 的教程.

You can implement a SOAP / WS-Security service using classic web services. Here's a tutorial from MSDN.

所有这些在 WCF 中都更容易.

All of this is easier in WCF though.

拉错了链接.这是我想粘贴的(使用 WSE 2 的 CodeProject 教程,虽然WSE 3 是最新版本,我专门使用了 WCF 之前的版本).

Pulled the wrong link. Here's the one I meant to paste (CodeProject tutorial that uses WSE 2, though WSE 3 is the latest release and I have used that exclusively pre-WCF).

这篇关于使用 ASP.NET 3.5 中的 ASMX 文件的 WS-Security的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆