Transferring values from the request to the response in SOAPUI

This is straightforward scripting done at the MockResponse level; the script uses properties of the mockRequest object to get hold of the incoming request, extracts the desired values via XPath and then writes the created result to a requestContext property

def temp="JavaVillage";
def groovyUtils=new
def xml=new XmlSlurper().parseText(mockRequest.requestContent)
        def v=it.toString()
context.session=temp+' Munna'

1. Created mock service as ContextResponse with script. Here will have single response, based on request will return response. From request will take name as a message will add with"Munna" string.

session creation in soapui

2. This is the response

Mock response using session in soapui

3. Start the server for contextService and execute request. Find the output below:

mock result using session in soapui