cancel
Showing results for 
Search instead for 
Did you mean: 

Error when making HTTP Post call using Utility VBO

yusuf.hoosain
Level 2
Hi

I am trying to make a SOAP service call to a service which requires certificate for authentication. I am able to make a call using POSTMAN which has the cert and key file loaded on POSTMAN. If I only load the cert without the key file I am unable to make the call.

I have imported the cert using the Utility VBO which returns a cert id.
Using this as an input along with the POSTMAN code stage I have copied all details of the request.
I have made a collection with one row for the headers as per postman:
--header 'Content-Type: text/plain' \




When I make the call using the Utility HTTP I receive the error :

Internal : Could not execute code stage because exception thrown by code stage: Cannot set null or blank methods on request.
Parameter name: value

If I change the method to POST I receive the error below:
Internal : Could not execute code stage because exception thrown by code stage: Object reference not set to an instance of an object.

I have attached the inputs of the request.
31839.jpg
Kindly advise how make this call using the Utility HTTP VBO. 
I tried using the WS Wizard but I am unable to locate the certificate when setting up, error :
No Certificate found matching that criteria. 

31840.jpg

Kindly advise on the steps required to call this service using Blue Prism.

Regards

Yusuf

------------------------------
Yusuf Hoosain
RPA Developer
Africa/Johannesburg
------------------------------​
28 REPLIES 28

Hello @ewilson,

Yes exactly. I don't have much experience with the API calls, so I'm trying to replicate the same approach I'm using in POSTMAN. Apart from client ID and client Secret authentication in headers and certificate, it is also necessary to add the private key to certificate.

Those are my setting of certificates in POSTMAN.

31534.png
​I deleted the try and catch from the code and I got this error:

31535.png
I assume that I don't associate the private key with the crt and maybe this is causing an error?

------------------------------
Marek Mroc
------------------------------

@Marek Mroc,

Is the API service that you're trying to call something that's publicly addressable? In other words, could I try calling it myself?

As for the private key, it's typically contained within the certificate in the form of a .PFX file (as opposed to a CRT/Key file combination). The CRT file contains just the public information about the certificate. So, it seems the HTTP VBO needs to be enhanced to handle this situation (a CRT/Key file combination) unless you have the actual PFX file? 

I'll research a bit more.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi @@ewilson,

No it is not, the Client ID and Client Secret are associated with an application which is making a call . The application is subscribed to the API and authenticated by .crt, private key and mentioned Client ID and Secret.

I generated the .pfx file via OPENSSL using this command:

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt

Then i tried to load .pfx file but I received this error this time:

31558.png
I can install pfx on windows 10 which I'm using locally, but the running resource for the BOT is a Windows Server 2016 and I am still getting invalid password message when I'm trying to install the pfx there. But if I manage to install the pfx cert, then load it by VBO, could this fix the issue?


------------------------------
Marek Mroc
------------------------------

@Marek Mroc,

When you generated the PFX file, using OpenSSL, did you enter a password? If so, did you supply that password to the Load Certificate action when you tried loading the PFX file in the VBO?

Cheers.


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi @@ewilson,

I did, I provided the pw but it was not working. So I generated the second pfx without any pw and the issue was the same.

Do I need to install the pfx first on a running resource in mmc?

31587.png


------------------------------
Marek Mroc
------------------------------

@Marek Mroc,

Silly question, but the password is not greater than 32 characters in length is it? My understanding is that you do not have to install the PFX first, but you can always try that.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

@Marek Mroc,

I think I know what's going on here. It seems that even though the private key is contained in the PFX file, the constructor we're using in the Load Certificate actions Code stage doesn't actually seem to read that private key. So, what you can try doing is change the Code stage from this:

31612.png
to this (notice the highlighted change). This also assumes you will be using a password with the PFX file.

31613.png
Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi @ewilson,

unfortunately I am still getting the same error

31626.png


------------------------------
Marek Mroc
------------------------------

@Marek Mroc,

Ok, that's a bummer. There are a few other things we can try here. First, I think we might need an additional flag along with the ephemeral flag. Can you try changing the X509KeyStorageFlags.EphemeralKeySet entry to this:

X509KeyStorageFlags.EphemeralKeySet | X509KeyStorageFlags.PersistKeySet​

If that one doesn't work, it might be that the key needs to actually be written to a store on disk. In that case, try changing the above to this:

X509KeyStorageFlags.UserKeySet | X509KeyStorageFlags.PersistKeySet​

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hello @@ewilson,

this time I've got an compiler error 😕

31656.png
I checked the NET Framework setup:

31657.png


------------------------------
Marek Mroc
------------------------------