8

Have called many restful services from asp before - but this one has me stumped. First my func looks like

Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP") 
with objHTTP 
.open "post", x_posturl, False 
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send x_xmlstr
end with

and the error returned is

msxml3.dll error '80072f0d' The certificate authority is invalid or incorrect

so, googled a bit and suggestion was to add line

.setOption 2, 13056

this gives error

msxml3.dll error '80072f0c' A certificate is required to complete client authentication

I then contacted service supplier and they suggested

Click on the certificate error next to the address bar, view the certificate, select Details, select Copy to File, and download it to a file. Install that into your trusted certificates on your server to stop the error appearing when trying to submit data.

So, tried that using instructions here - but still no joy, any help appreciated

AnonJr
  • 2,759
  • 1
  • 26
  • 39
zima10101
  • 307
  • 1
  • 4
  • 16
  • think have installed cert correctly - but now get error msxml3.dll error '80072f99' No credentials were available in the client certificate. this person has similar issue http://forums.aspfree.com/asp-development-5/msxml3-dll-error-80072f99-security-error-occurred-359962.html howver the link to solution is no-longer active ;(( – zima10101 Nov 06 '13 at 16:59
  • am now trying to give NETWORK SERVICE read access to c:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys however i get error "failure to enumerate objects in container - access is denied" any ideas welcome – zima10101 Nov 06 '13 at 21:31
  • have taken ownership of folder and added permission for IIS AppPool\DefaultAppPool and now get error msxml4.dll error '80072f8f' A security error occurred is this still folder permission error? – zima10101 Nov 06 '13 at 22:12
  • also changed serverxml to MSXML2.ServerXMLHTTP.4.0 – zima10101 Nov 06 '13 at 22:15
  • Does this answer your question? [VBA ServerXMLHTTP https request with self signed certificate](https://stackoverflow.com/q/11573022) (Same issue with the same library just in VBA so the difference is minimal). – user692942 Oct 09 '20 at 08:32
  • Does this answer your question? [A certificate is required to complete client authentication](https://stackoverflow.com/q/20242029) – user692942 Oct 09 '20 at 08:35

2 Answers2

2

It seems like the server located at x_posturl has a certificate that is misconfigured, or that your client computer doesn't contain/recognize the certificate's root authority (most likely). There are a few options to fix:

  1. Have them fix their certificate if it's misconfigured.
  2. If their certificate is valid, but with a root authority your machine doesn't recognize, then you need to install the root authority certificate locally.
  3. Instruct MSXML2.ServerXMLHTTP to ignore certificate errors, which appears to be answered here: VBA ServerXMLHTTP https request with self signed certificate
  4. Change x_posturl to start with http:// instead of https://— if it's supported by the provider. Would not recommend this in a production scenario though.

Can you share specifically what x_posturl is? We should be able to debug by looking at the SSL handshake.

Jim Heising
  • 4,260
  • 2
  • 16
  • 16
2

I was able to find the solution by passing in a param.

objHTTP.SetOption 2, objHTTP.GetOption(2)

Dim objHTTP
Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.SetOption 2, objHTTP.GetOption(2)
objHTTP.Open "post", x_posturl, False 
objHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.Send x_xmlstr
Ravi Ram
  • 24,078
  • 21
  • 82
  • 113