Forum Discussion

ryanshoward's avatar
ryanshoward
Occasional Contributor
10 years ago

Setting HTTP endpoint based on Soap Response

I am calling a soap service which returns a url in a node in the response. I want to call this url using an HTTP request. whats the best way to set the HTTP end point to the url in the soap response...
  • rupert_anderson's avatar
    10 years ago

    Hi,

     

    Firstly I would probably use a HTTP Request TestStep to make the HTTP request based on the extracted URL. To extract and transfer the URL value to the HTTP Request TestStep, you could use a property transfer TestStep (http://www.soapui.org/functional-testing/properties/transferring-properties.html).

     

    Another option for extracting the URL from the response and setting the HTTP Request TestStep Endpoint is to use a Groovy Test Step and do the work with Groovy, I generally prefer this option, so can supply code examples if needed. You can also make the HTTP request programatically from the Groovy TestStep if need be.

     

    Let me know if you need more tips / help with this.

     

    Cheers,

    Rupert

  • nmrao's avatar
    nmrao
    10 years ago

    Rup suggested the different possible ways to achieve this and that is the way.

     

    This is also on similar lines, but uses script assertion for soap request step instead of an additional step as given below(this is in code form of what Rup had explained).

     

     

    /** code block for script assertion step of soap request **/
    import com.eviware.soapui.support.XmlHolder def response = new XmlHolder(context.response) //replace your xpath of node def urlFromResponse = response.getNodeValue("/path/to/node") assert null != urlFromResponse, "Response contains no value" context.testCase.setPropertyValue('END_POINT_URL', urlFromResponse)

     

    And use endpoint for HTTP request step as ${#TestCase#END_POINT_URL}