Forum Discussion

preetkanwalsing's avatar
15 years ago

oAuth and REST testing using SOAPUI

I am looking for a way to test oauth REST web services using SOAPUI

Below is a sample request response code-

Calling URL [http://ssod3.autodesk.com/auth/oauth/requestToken] with header [OAuth realm="http://sp.example.com/", oauth_consumer_key="2qt24v4089a7pf4s", oauth_signature_method="HMAC-SHA1", oauth_signature="rnbdloBykUQv6330BX6PcN%2BH6tU%3D", oauth_timestamp="1261080571", oauth_nonce="903b8761947ccf06758505e95635e3dc", oauth_version="1.0"]
Http Response Status: HTTP/1.1 200 OK
Request Token Response=oauth_token=1vgsept65gh33q7d&oauth_token_secret=1fhpaqk0pokuuv3l


I want to know to send\reciever these kind of requests-responses using SOAPUI.
Thanks,
-Preet
  • nickspacek's avatar
    nickspacek
    Occasional Contributor
    I'm testing a WebService that uses a similar sort of authentication. The first request to the WebService is for authentication, and the response contains a token that must be sent in all the rest of the requests.

    To make this work, that authentication test has to be run first (not ideal). I wrote a GroovyScript test step that saves the token to the TestSuite. I wanted to save the token to the current set of tests that are being run, but I'm not sure where to put it so that it is accessible for all the tests currently being run (any advice would be great).

    It works as is, and for better or worse the token sticks around in the TestSuite properties permanently. This has the side-effect/benefit of allowing me to run tests after the authentication test. Here's the script:
    def gu = new com.eviware.soapui.support.GroovyUtils( context );

    def xml = gu.getXmlHolder( 'Authenticate - Default#Response' );
    def token = xml.getNodeValue( '/auth/token' );
    log.info( 'Got token: ' + token );

    def suite = context.testCase.testSuite;
    suite.setPropertyValue( 'auth_token', token );
    log.info( 'Saved auth_token to suite.' );
  • irose's avatar
    irose
    New Contributor
    Ole,

    I am also trying to perform a similar call to the initial thread and the logic I though I should follow from the soapUI app design was to specify the web service request definition, in this case, requestToken, including the header info, then attach the test case to the service call. If I tried to use your approach, I am defining part of the service call within the test case, which would make a potential test design issue? Although at this point I am just starting with soapUI, and my org is in the eval / purchase mode, if I get this to work, think I can cost justify several licenses for soapUI. Help please!!! Is there pre-sales support? I need to get our first three service calls to work to justify.
  • Any progress in this area would be a major win for us too! Currently we have a custom web app acting as a proxy for all OAuth connections to our API.

    It works, but natively handling it in SOAPUI would be a little classier.