Forum Discussion

sudeshkulal's avatar
sudeshkulal
New Contributor
7 years ago

How to use AWS Signature in SOAPUI Test case?

I have to call a service which requires 'AWS Signature' to be called.

It is easy to use AWS Signature in POSTMAN tool but no provision available in SOAPUI.

 

AWS Signature is nowadays becoming strong so anybody suggests how to use it in SOAPUI Free version?

As part of AWS Signature I have following things:

service

region

access_key

secret_key

  • JHunt's avatar
    JHunt
    Community Hero

    It looks like you can get a library to calculate the signature: https://stackoverflow.com/questions/35985931/how-to-generate-signature-in-aws-from-java

     

    aws-v4-signer-java is a lightweight, zero-dependency library that makes it easy to generate AWS V4 signatures.

     

    String contentSha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
    HttpRequest request = new HttpRequest("GET", new URI("https://examplebucket.s3.amazonaws.com?max-keys=2&prefix=J"));
    String signature = Signer.builder()
            .awsCredentials(new AwsCredentials(ACCESS_KEY, SECRET_KEY))
            .header("Host", "examplebucket.s3.amazonaws.com")
            .header("x-amz-date", "20130524T000000Z")
            .header("x-amz-content-sha256", contentSha256)
            .buildS3(request, contentSha256)
            .getSignature();

    And in theory, it's just a case of adding an Authorization header with some calculated value.

     

    However, the problem is still going to be that you need to calculate the signature based on each request itself, and that's based on the HttpRequest object. SoapUI automatically generates the HttpRequest and immediately sends it when it executes a Request, with no chance for you to write a script to modify it. So you'd have to modify SoapUI or send the HttpRequest in your own script.

     

    Ultimately, it's probably not impossible, but very impractical to do it with SoapUI as it is. Not a lot of new features get added to the Open Source version, but who knows, somebody might volunteer to build it...

    • sudeshkulal's avatar
      sudeshkulal
      New Contributor

      Thanks, JHunt.

       

      Let me give a try and get back to you with some result.