Forum Discussion

matheusgeovanni's avatar
matheusgeovanni
New Member
4 years ago

Token - Password Digest - Automation

Hello. In a SOAP request, it is necessary for each execution to "renew" the token using the steps below:

1 - Delete the Header
2 - Right-click on the soap UI project
3 - Click on 'Add Username Token'
4 - Password digest

Then, the header is created with the token and with that we can make the request successfully.

I would like to do this automatically. It's possible ? If not, is there any way or API that will return this token to me? How does SoapUi create this token? Would it be possible to create it from external sources (outside of soapUi)?






Olá. Em uma request de SOAP, é necessário a cada execução "renovarmos" o token por meio dos passos abaixo:

1 - Apagar o Header
2 - Clicar com o botão direito no projeto soap UI
3 - Clicar em 'Add Username Token'
4 - Password digest

Em seguida, o header é criado com o token e com isso podemos fazer a request com sucesso.

Gostaria de fazer isso de forma automatica. É possivel ? Se não, existe algum modo ou API que me retorne esse token ? Como o SoapUi cria esse token ? Seria possivel a criação do mesmo por fontes externas (fora do soapUi) ?






1 Reply

  • richie's avatar
    richie
    Community Hero

    Hey matheusgeovanni 

     

     

    If I understand your request correctly - you're saying that you need each request to include an updated value, then yes that's entirely possible and you don't have to use groovy script either.

     

     

     

    I didn't really understand the following:

     

    1 - Delete the Header
    2 - Right-click on the soap UI project
    3 - Click on 'Add Username Token'
    4 - Password digest

     

    Could you add some screenshots that match the steps above - just so I can visualise what you mean please?

     

     

    I'm guessing what you need to do here - but if you just need an updated header value each time you run  the next test - I'd create a 'setup testsuite' containing a testcase with your REST step that generates these token values for you.  Immediately after the test step that generates the token value, I'd add in a property transfer step to save the newly generated token value to a custom project level property (entitled 'tokenHeader').

     

    Assuming each test case has a request that needs a new token value, I'd include as the first test step in my test (BEFORE the REST request that needs the new token value), a 'Run TestCase' step, which points back to the 'setup testsuite's testcase.

     

    The next test step in my test would be the relevant REST request that is being tested (which needs the new token value) and the token Header's value would be set as '${#Project#tokenHeader}.

     

    That's about the most straightforward way I can think of to do this.  

     

    ta

     

    rich