Re: sending xml via post, https request with certi - WeOnlyDo Discussion board

Re: sending xml via post, https request with certi (General questions)

by genzel, Wednesday, February 11, 2009, 16:04 (5763 days ago) @ woddrazen

Hello Drazen,
thanks for your tip. The scenario is we gave the public key to our customer and sending the xml docs via private key to our customer.

Here are the solution ... draft ;-)

Function send_with_cert(Optional strUrl As String, Optional strXML As String)
' T.Genzel 2009
Dim cert As Certificate
Dim hFile As Long
Dim whttp As wodHttpDLX
Set whttp = New wodHttpDLX


Set cert = get_certbyCN(10, mycompany )


Debug.Print cert.CommonName

'cert.show ( My Cert )

Set whttp.Certificate = cert
cert.LoadKey ( load private key here )

whttp.ProxyType = ProxyWindows
whttp.ProxyAuthentication = AuthNTLM '
whttp.ProxyHostname = proxyadress
whttp.ProxyLogin = yourloginname
whttp.ProxyPassword = yourpwd
whttp.ProxyPort =


whttp.Blocking = True 'will return to your code until the command completes
whttp.Request.Headers.Add Content-type , text/xml; charset=utf-8
whttp.Timeout = 60
whttp.DebugFile = D: empinetpubfiledebug.txt
whttp.Request.Body = strXML
whttp.port = 443
whttp.URL = strUrl
On Error Resume Next
whttp.Post


'get resposne
'response.Write whttp.Response.Body
If whttp.Response.StatusCode = 200 Then
Debug.Print whttp.Response.Body
Else
Debug.Print ERROR - Status: & whttp.Response.StatusCode & whttp.Response.Status & <br>
Debug.Print whttp.LastErrorText & / & whttp.LastError
Debug.Print whttp.Response.Body
End If
whttp.DisConnect
Set whttp = Nothing

End Function

Now, we will wait for the customer, if there is a go we will buy the component.

Best regards,
Torsten


Complete thread: