Robotic Process Automation (RPA)

Robotic Process Automation (RPA)

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

Error in calling bots through API

  • 1.  Error in calling bots through API

    Posted Wed August 03, 2022 07:53 AM

    I am facing an error on calling every bot I try through API.

    "Error trying to execute script. Unable to cast object of type 'Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters' to type 'Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair'."

    I have configured Vault on my RPA server, it was working well. Later on, I set up another computer and added it to the control center, after that, I am facing this error on calling the bot through API. I have then tried to upload new keys in the Tenant Credentials but could not do that.
    Please help me out of this.



    ------------------------------
    JAMIL UDDIN SYED
    ------------------------------


  • 2.  RE: Error in calling bots through API

    Posted Wed August 03, 2022 08:12 AM

    Have you tried to add the private key on this new computer?


    For all computers of a tenant, which has public and private keys configured, you need to add them on the folder you have configured on RPA control center for that tenant.


    For example, I have the path C:\keys\privkey.pem so, for each new computer, I need to add the key files on this folder.



    ------------------------------
    Giulianele Alves Barbosa
    ------------------------------



  • 3.  RE: Error in calling bots through API

    Posted Wed August 03, 2022 08:52 AM
    First I tried uploading new keys, but it didn't upload. Then I tried placing the old key in the same location but it didn't work.





  • 4.  RE: Error in calling bots through API

    Posted Thu August 04, 2022 01:06 PM
    Hi Jamil,

    What API are you using and what is the syntax of your REST call?

    ------------------------------
    NIGEL CROWTHER
    ------------------------------



  • 5.  RE: Error in calling bots through API

    Posted Fri August 05, 2022 12:58 AM
    I am using Postman API.
    here is the syntax;
    http://192.168.10.200:8099/scripts/test200

    and this is the outcome;
    <IntegrationErrorResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://automation.wdg.com/services/2016/07/01">
    <ErrorMessage>Unable to cast object of type 'Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters' to type 'Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair'.</ErrorMessage>
    <Exception>System.InvalidCastException: Unable to cast object of type 'Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters' to type 'Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair'. at WDG.Cryptography.RsaParametersFactory.CreatePrivateParametersFromPemFile(Byte[] , String ) at WDG.Automation.Cryptography.CredentialPasswordService.dcSbCEXw9N(CredentialModel , CredentialPrivateKeyConfigurationModel , Boolean ) at WDG.Automation.Cryptography.CredentialPasswordService.WDG.Automation.Cryptography.ICredentialPasswordService.Decrypt(CredentialModel , CredentialPrivateKeyConfigurationModel , Boolean ) at WDG.Automation.Service.Extensions.Wfkhts9dG6moOyl0KRi(Object , Object , Object , Boolean ) at WDG.Automation.Service.Extensions.UpdateWith(ServiceAgentParameters , ICredentialPasswordService , ExecutionResponseModel , TimeSpan ) at WDG.Automation.Service.ServiceAgent.DlDS3araeG8OfhlYPR.<Run>d__4.gwTQU7GQS2JKmGrpWah(Object , Object , Object , TimeSpan ) at WDG.Automation.Service.ServiceAgent.DlDS3araeG8OfhlYPR.<Run>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at WDG.Pipeline.DefaultPipelineMiddleware`1.<WDG-Pipeline-IAsyncMiddleware<TParameter>-Run>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at WDG.Pipeline.AsyncPipeline`1.<>c__DisplayClass10_0.I5NO1rxsUXb4YbxUIdW.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at WDG.Pipeline.DefaultPipelineMiddleware`1.<WDG-Pipeline-IAsyncMiddleware<TParameter>-Run>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at WDG.Pipeline.AsyncPipeline`1.<>c__DisplayClass10_0.I5NO1rxsUXb4YbxUIdW.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at WDG.Pipeline.AsyncPipeline`1.<ExecuteAsync>d__10.MoveNext()</Exception>
    <NoAvailableLicenses>false</NoAvailableLicenses>
    </IntegrationErrorResponse>


    ------------------------------
    JAMIL UDDIN SYED
    ------------------------------



  • 6.  RE: Error in calling bots through API

    Posted Fri August 05, 2022 04:32 AM
    Edited by NIGEL CROWTHER Fri August 05, 2022 04:34 AM
      |   view attached
    A couple of things I noticed, you are using HTTP.  I thought the API only worked with HTTPS. 

    Also, you are invoking the bot without parameters.  Is that right? 

    If you are struggling, a OpenAPI template for invoking a bot using the synchronous API is attached.  You will need to change it to the name of your bot and add the appropriate parameters, but other than that the OpenAPI spec should work.

    You can view the template using  Swagger Editor

    Swagger remove preview
    Swagger Editor
    View this on Swagger >


    ------------------------------
    NIGEL CROWTHER
    ------------------------------

    Attachment(s)

    yaml
    RpaSyncAPIOpenAPI.yaml   1 KB 1 version


  • 7.  RE: Error in calling bots through API

    Posted Fri August 05, 2022 04:56 AM
    I nearly forgot to mention, that there is a new lab on generating an OpenAPI and invoking it  here:

    Lab 12 - Exploring the RPA API

    ------------------------------
    NIGEL CROWTHER
    ------------------------------



  • 8.  RE: Error in calling bots through API

    Posted Fri August 05, 2022 07:02 AM
    I am using HTTPS, and previously, it was all working well. It is a simple bot just for test purposes and doesn't require any parameters.
    It is all because of setting another client with the server.(caused by the Vault Configuration)

    ------------------------------
    JAMIL UDDIN SYED
    ------------------------------



  • 9.  RE: Error in calling bots through API

    Posted Fri August 05, 2022 07:07 AM
    I missed the step initially, but later on, I did place the private key accordingly but the error still exists.

    ------------------------------
    JAMIL UDDIN SYED
    ------------------------------



  • 10.  RE: Error in calling bots through API

    Posted Fri August 05, 2022 08:02 AM
    Is it a virtual machine? If yes, try to pass ?unlockMachine=true to your syntax,  http://192.168.10.200:8099/scripts/test200?unlockMachine=true

    ------------------------------
    Giulianele Alves Barbosa
    ------------------------------



  • 11.  RE: Error in calling bots through API

    Posted Sat August 06, 2022 05:50 AM
    Try to run this bot with the scheduler.  Its likely to be the same issue with incorrect certificates or credentials on your target computer.  Reinstall RPA on the VM if you are still having issues.

    ------------------------------
    NIGEL CROWTHER
    ------------------------------