Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Both - Traffic Object - What is the input?

When adding an extension tool for scripting, what is the actual input if I select Both - Traffic Object? Is that the entire request and response?
Thanks,
JT

Tagged:

Comments

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Hi,

    From a quick inspection of the two arguments passed into the script it appears that the first is a "map" and the second is the "context"

    Using the example below these are the following keys in the map that point to various different objects
    Request HTTP Headers
    Request MIME
    Response HTTP Headers
    Response MIME
    Test Name
    XML Request
    XML Request Time in Nanoseconds
    XML Response
    XML Response Time in Nanoseconds

    This is the code that was used to check what the argument types are

    import com.parasoft.api.Application
    def checkClass(one, two) {
    Application.showMessage(one.getClass().toString())
    Application.showMessage(two.getClass().toString())

    map = one
    map.each{ key, value -> Application.showMessage(key) }
    }

  • jefftuckerbofa
    jefftuckerbofa Posts: 234

    Would it be possible to capture the Request components, swap out the host and port and then forward the request using Groovy (similar to how the Message Forward client works) ?

    JT

  • jefftuckerbofa
    jefftuckerbofa Posts: 234

    I had a HUGE ah-ha! moment today WRT scripting. I just figured out how important it is to write script in VAs on your local server and monitor the Console using the available tools, especially Application.showMessage(). This opens up a whole new world WRT scripting. I have already written the code to do what I asked in my question above. Very nice product you have in Virtualize.

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Yes! Developing the script locally makes it so that you can see all those print/show message statements which I also have found very helpful.

  • jefftuckerbofa
    jefftuckerbofa Posts: 234

    thanks unrelated, but is there a way to authenticate calls to the Parasoft using a token vs basic auth?

    JT

  • benken_parasoft
    benken_parasoft Posts: 1,297 ✭✭✭

    thanks unrelated, but is there a way to authenticate calls to the Parasoft using a token vs basic auth?

    You would need to enable OIDC. See Configuring OpenID Connect

    Then calls to various things, including calls to the REST API, will require an access token instead of basic auth.

  • benken_parasoft
    benken_parasoft Posts: 1,297 ✭✭✭

    The last link I included is now bad. Here are the correct links for enabling OIDC.

    SOAtest/Virtualize: OpenID Connect
    CTP: Configuring OpenID Connect
    DTP: Configuring OpenID Connect