Contributions
Re: [R] authorization Token from REST Response to other REST Hea
I have 2 issues with the suggested solution:- 1. I have to keep the same Login test step included in each test case and located before the required test step, this is a problem if I have 200 test cases, example:- 2. How can I remove the token HTTP header the event’s script adds each time we run the test case?11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.1KViews0likes0CommentsRe: [R] authorization Token from REST Response to other REST Hea
Hi, I don't have more than one header, here's a real Raw response for you to view as example. Also the token I'm extracting doesn't contain any "[]":- what did you mean by replacing the method that I'm currently using? Here's the SubmitListener.afterSubmit I'm using in my events:- if( submit.response == null ) { return } def headers = submit.response.responseHeaders context.testCase.setPropertyValue( "authorization", headers.get("uxfauthorization").toString() )11 years agoPlace ReadyAPI QuestionsReadyAPI Questions9.7KViews0likes0CommentsRe: [R] authorization Token from REST Response to other REST Hea
1. I was able to get the token in a property, but it is contained in "[]", how can I select it without them? example of what I have now:- 2. Using the second event to add the header in the REST's request it's missing the value, the actual token, as shown here:- code used as suggested:- def headers = request.requestHeaders headers.put( "authorization",context.testCase.getPropertyValue( "SavedUxfToken",SavedUxfToken ) ) request.requestHeaders = headers What is missing?11 years agoPlace ReadyAPI QuestionsReadyAPI Questions9.7KViews0likes0CommentsRe: Pass cookie value to another request
akeo wrote: Please see this Groovy script. --- // You can get http header of "Set-Cookie" from "login someone" test step in soapUI def setCookie = testRunner.testCase.testSteps["login someone"].testRequest.response.responseHeaders["Set-Cookie"] // if you want to get JSESSIONID=value, use this regular expression re = /(JSESSIONID=[A-Za-z0-9]+)/ matcher = ( setCookie =~ re ) def jsesid = matcher[0][0] // confirm the JSESSIONID with log.info log.info "$jsesid" // Set the ID to TestCase cookie property def tc = testRunner.testCase.testSuite.getTestCaseByName("sample testcase") tc.setPropertyValue("cookie","$jsesid") --- TestCase property is able to use a http cookie header's value. Enter "${#TestCase#cookie}" to "Value" and "Cookie" to "Header" in a Test Step's "Header" part. Please try it. Thank you. Hi, I need to get the token from Login REST then to add it as a header with name: "authorization" and value: "the actual token we get" By using what you suggested I was able to see the token:- def setCookie = context.testCase.testSteps["/smb/Login - Request"].testRequest.response.responseHeaders["uxfauthorization"] My question is how can I transfer it to the next REST's request as header? I appreciate the help. BTW, you can see my full POST here:- viewtopic.php?f=2&t=231329KViews0likes0CommentsRe: [R] authorization Token from REST Response to other REST Hea
Hi, what I understand from your help that I should create two event handlers like shown below and add the pieces of code. Create a property in the testCase for grabing the token e.g. "uxfToken" with Name="authorization" and Value=empty Then create another property for for adding the header in the REST's request Now I have 2 event handlers and 2 properties, how can I make things work at this stage ? (appologies since I'm new to SoapUI)11 years agoPlace ReadyAPI QuestionsReadyAPI Questions9.7KViews0likes0Comments[R] authorization Token from REST Response to other REST Hea
Hi, I’ve started using SoapUI Pro 4.5.1 few days ago and soon moving to 4.6.4 (within 2 days). Some of the RESTs require the generated authorization Token we get from the Login REST Response e.g. We invoke the login REST Once passed we get EmptyObject as json response and then we have to manually extract the uxautherization token and use it in the next REST's header as follows:- How can I make this happen for each one of the RESTs which requires the authorization header and Token gotten from the latest Login Response to be updated in the REST before it's invoked (Run). And please note that the the Token part is needed that comes after the ":" as shown in the Login Response. Things I tried so far:- I added the Login Request test to the other REST's TestCase and created a property transfer from the Login Response to the other REST's Request as follows:-11 years agoPlace ReadyAPI QuestionsReadyAPI Questions13KViews0likes11Comments