Forum Discussion

ohaya's avatar
7 years ago

SOLVED-Trying to get the SAML <Assertion> element from a response to Transfer property

Hi,   I am trying to get the signed SAML <Assertion> element from a response to one test step in one test case into a Transfer property, so that I can inject that assertion into the body of a reque...
  • ohaya's avatar
    7 years ago



    Sort of answering my original question, the following in a groovy script step seems to be able to get the raw response:


    def rawResponse = testRunner.testCase.testSteps["TC1 - NoAttribs"].testRequest.response.rawResponseData new String(rawResponse)

    However, the rawResponse has not just the XML I am interested in, but also the HTTP response headers, etc.:


    Wed Apr 04 14:36:19 EDT 2018:INFO:HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Connection: close
    Content-Type: text/xml;charset=UTF-8
    Content-Length: 4249
    Date: Wed, 04 Apr 2018 18:31:13 GMT
    Connection: close
    <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="">


    I now need to strip off that stuff to get the XML so that I can then parse it for the <saml2:Assertion> element.  That's the next thing I need to figure out how to do :(...


    Does anyone know of an easy way to do that with Groovy?