1
votes

I understand that Classic ASP is not a preferred language and that it should be abandoned. Those are certainly my thoughts. In any case, let's assume it's my only option.

The Problem

I have a WCF web-service written in C# hosted at some uri https://blah/blah.svc. I have been talking to it with a Classic ASP client by manually forming SOAP calls and using Server.CreateObject("Msxml2.XMLHTTP.3.0") to make requests and get responses.

Now the WCF service has been updated to use certificate authentication. I've seen clients use cert auth in PHP and .Net, but I have no idea how one would connect using Classic ASP.

Any ideas?

Example of my current Classic ASP client

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
1
Take a look at the answer from Simian in the following SO question: SOAP API HTTPS - Connecting with Classic ASP. Here is another question on SO on the subject: Can't use HTTPS with ServerXMLHTTP object.Guido Gautier
@GuidoGautier The second recommendation might be on the right track. I'll give pjumble's response a shot.bdeetz

1 Answers

0
votes

If it is a possibility - instead of constructing this in the ASPX page use a "proxy" which is a method that you can post your request via Ajax, which in turn would communicate with downstream service and send you back the response.

In this case your proxy (application) could be an MVC app using WCF client.

Crafting encrypted SOAP messages manually is hard, specially from Ajax.