Forum Discussion

dan007's avatar
14 years ago

Dynamic Mock Service as proxy fails

Hi all

When I try to create a dynamic Mock Service (see http://soapui.org/Service-Mocking/creating-dynamic-mockservices.html) with a dispatch script.


log.info "Script Soap12TestDocBindingProxy started"

// get target request
def project = mockOperation.mockService.project
def operation = project.interfaces["Soap12TestDocBindingProxy"].operations["echoOk"]
def request = operation.getRequestByName("Request 1")

// set request from incoming
request.requestContent = mockRequest.requestContent

// submit request asynchronously
request.submit( new com.eviware.soapui.impl.wsdl.WsdlSubmitContext( request ), false )
log.info "responseAsXml " + request.responseContentAsXml

// save response to context
requestContext.responseMessage = request.responseContentAsXml
return "Request 1"


This gives following script.log:
Sun Oct 30 19:39:25 CET 2011:INFO:Script Soap12TestDocBindingProxy started
Sun Oct 30 19:39:25 CET 2011:INFO:responseAsXml null

When I edit the Request 1

then the code runs without problem.

Script.log:
Sun Oct 30 19:46:56 CET 2011:INFO:Script Soap12TestDocBindingProxy started
Sun Oct 30 19:46:56 CET 2011:INFO:responseAsXml <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ts="http://example.org/ts-tests">
<soap:Header/>
<soap:Body>
<ts:responseOk>vom Server</ts:responseOk>
</soap:Body>
</soap:Envelope>


The problem is, that I want run this proxy in background (using mockservicerunner.bat resp. mockservicerunner.sh) and there I can't edit the request script before using it.

I'm using SoapUI 4.0.1 for Mac OS X and SoapUI 4.0.1 for Windows.

Thanks all
No RepliesBe the first to reply