0

I am using soapui to hit a webservice it's working but im trying to create an implementation with PowerShell, the probleme is im using Invoke-RestMethod to send my request with -certificate and I call my certificat in this way :

$Certificat = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$Certificat.Import($Dir,$password,"DefaultKeySet");
$status = Invoke-RestMethod -Method 'Post'  -Uri $url -Body $body -Certificate $Certificat

the server return 403 error that mean he didnt receive the certificat. my question is there is another method to implement the sending of soap ui call with certificat that require a password.

Jamal
  • 21
  • 3
  • This would seem to be a duplicate of this Q&A. --- https://stackoverflow.com/questions/13994164/soapui-certificate-authentication – postanote Apr 29 '19 at 07:37
  • @postanote I want to figure out hwo to use it with PowerShell, in this link he ask to configure soapui with client athentification – Jamal Apr 29 '19 at 07:42

1 Answers1

0

Looking at your code again, (I guess I should have scrolled all the way right), you are not specifying a cert.

This...

$Certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2

... try it this way.

$Certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("C:\mycert.cer")
postanote
  • 15,138
  • 2
  • 14
  • 25
  • $Certificat.Import($Dir,$password,"DefaultKeySet"); the $dir is my directory certificat and his password thank you but thats not the probleme – Jamal Apr 29 '19 at 09:15