Forum Discussion

srikanthrapolu's avatar
srikanthrapolu
Occasional Contributor
12 years ago

SOAPUI MockService automaion

HI All,

I have a requirement to generate a mock service by taking WSDL file. I do not want to do it using SOAPUI gui instead i want to do using scripts in an automated way. So that i can give the wsdl file as input to script and it generates the mockservice xml.

So does SOAPUI expose any batch files or API's which i can call from ant scripts to generate a mock service.

Thanks
Srikanth Rapolu

3 Replies

  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    Hi
    usually, the process with the GUI is
    * create a project
    * import the wsdl
    * create the mock service
    * create mock operation
    * then add some logic in your mock (mock operation selection and content

    For the 1st 4 steps, you could use java code to do this. But the last step depends on what you want to achieve, so it will remain some manual things to do.
  • srikanthrapolu's avatar
    srikanthrapolu
    Occasional Contributor
    Hi All,

    Thanks redfish4ktc2 for your insights. I was able to accomplish it.

    We now have another requirement to automate the generation of REST mock services using wadl file in SOAPUI 4.6.4. As said earlier, I do not want to do it using SOAPUI gui instead i want to do using scripts in an automated way. So that I can give the wadl file as input to script and it generates the mockservice xml.

    So does SOAPUI expose any batch files or API's which i can call from ant scripts to generate a mock service for REST?

    PS - I learn that SOAPUI 5.0 has the 'generate mockservice' feature to generate mock service using wadl file. However, for SOAP UI 4.6.4 the process is more manual. How do we automate this in 4.6.4?

    Thanks,
    Srikanth Rapolu
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    hi, real rest mock services are only available with soapui 5+
    previous soapui version can support rest mocking by using grovvy scripts, see http://www.soapui.org/Service-Mocking/c ... m-response
    extract
    This is currently the only way to mock a REST or more complex HTTP service with soapUI; the OnRequest script on the MockService level gives you direct access to the underlying HttpRequest and HttpResponse objects allowing you to create whatever response you would like to. All you need to be sure of is that the script returns a MockResult object which tells soapUI to stop processing the request