Forum Discussion
omatzura
16 years agoSuper Contributor
Hi Leinand,
sure! You can submit an existing request in your project with its submit(..) method and then await the response before returning it.. all this could be done in the Script associated with the MockResponse.. something like the following:
// get request to submit
def request = context.mockService.project.interfaces[".."].operations[".."].requests[".."]
// set content and other properties (headers, attachments, endpoint, etc..)
request.requestContent = mockRequest.requestContent
// submit synchronously
request.submit( new WsdlSubmitContent( request ), false )
// get response
context.responseContent = request.response.contentAsString
..
And then in the mockResponse content editor just put
${responseContent}
Which should be replaced by the corresponding context variable assigned in the last statement in the script above..
This should get you going.. let me know otherwise!
regards,
/Ole
eviware.com
sure! You can submit an existing request in your project with its submit(..) method and then await the response before returning it.. all this could be done in the Script associated with the MockResponse.. something like the following:
// get request to submit
def request = context.mockService.project.interfaces[".."].operations[".."].requests[".."]
// set content and other properties (headers, attachments, endpoint, etc..)
request.requestContent = mockRequest.requestContent
// submit synchronously
request.submit( new WsdlSubmitContent( request ), false )
// get response
context.responseContent = request.response.contentAsString
..
And then in the mockResponse content editor just put
${responseContent}
Which should be replaced by the corresponding context variable assigned in the last statement in the script above..
This should get you going.. let me know otherwise!
regards,
/Ole
eviware.com