【问题标题】:Connect to WCF Using Certificate Authentication in Classic ASP在经典 ASP 中使用证书身份验证连接到 WCF
【发布时间】:2012-04-10 16:03:49
【问题描述】:

我了解 Classic ASP 不是首选语言,应该放弃它。这些当然是我的想法。无论如何,让我们假设这是我唯一的选择。

问题

我有一个用 C# 编写的 WCF Web 服务,托管在某个 uri https://blah/blah.svc。我一直在与经典 ASP 客户端通过手动形成 SOAP 调用并使用 Server.CreateObject("Msxml2.XMLHTTP.3.0") 来发出请求并获得响应。

现在 WCF 服务已更新为使用证书身份验证。我见过客户在 PHP 和 .Net 中使用 cert auth,但我不知道如何使用 Classic ASP 进行连接。

有什么想法吗?

我当前的经典 ASP 客户端示例

Dim objXMLHTTP : set objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim strRequest, strResult, strFunction, strURL, strNamespace

strNamespace = "http://tempuri.org/IBlah/test"
strURL = "https://blah/Blah.svc"

strFunction = "test"

strRequest = "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:tem=""http://tempuri.org/"">" _
& "   <soapenv:Header/>" _
& "   <soapenv:Body>" _
& "      <tem:test>" _
& "         <tem:testdata>" & testdata & "</tem:testdata>" _
& "      </tem:test>" _
& "   </soapenv:Body>" _
& "</soapenv:Envelope>"

objXMLHTTP.open "post", strURL, False

objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"

objXMLHTTP.setRequestHeader "SOAPAction", strNamespace

'send the request and capture the result
Call objXMLHTTP.send(strRequest)
response = objXMLHTTP.responseText

【问题讨论】:

标签: wcf authentication asp-classic certificate


【解决方案1】:

如果有可能 - 使用“代理”代替在 ASPX 页面中构建它,这是一种您可以通过 Ajax 发布您的请求的方法,该方法反过来会与下游服务通信并将响应发回给您。

在这种情况下,您的代理(应用程序)可以是使用 WCF 客户端的 MVC 应用程序。

手动制作加密的 SOAP 消息很困难,特别是来自 Ajax。

【讨论】:

    猜你喜欢
    • 2010-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-11
    • 2016-03-26
    • 2010-11-24
    • 1970-01-01
    相关资源
    最近更新 更多