【发布时间】: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
【问题讨论】:
-
在以下 SO 问题中查看 Simian 的答案:SOAP API HTTPS - Connecting with Classic ASP。这是关于这个主题的另一个问题:Can't use HTTPS with ServerXMLHTTP object.
-
@GuidoGautier 第二个建议可能是正确的。我会试一试 pjumble 的回应。
标签: wcf authentication asp-classic certificate