Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
17 years ago

groovy help

hello,
I want to be able to download the WSDL before i run a project so that I can have a history of the WSDL across various builds.

can you help me with some groovy code that downloads the file locally given the wsdl address.

thanks

Ali

3 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    I need some more info here:

    1) Exactly when do you want to do this? When opening the project? Running a TestCase?

    2) To where should the WSDL and included files be saved?

    regards!

    /Ole
    eviware.com
  • alibaba82's avatar
    alibaba82
    Super Contributor
    I have a project which I run first to do some checking before I run the remaining projects. This project has some test cases which checks if databases are populated etc. I want to add another test cases which would download all the WSDL locally to some specified location.

    1. So this would happen when a new build comes out and I run the diagnostics project. One of the test cases within this diagnostic project will download all the specified WSDL to some folder.
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    try the following in a groovy script:

    import com.eviware.soapui.impl.wsdl.support.wsdl.CachedWsdlLoader

    def iface = testRunner.testCase.testSuite.project.interfaces["..."]
    def loader = null;
       
    if( iface.cached )
    {
    loader = iface.createWsdlLoader()
    }
    else
    {
    loader = new CachedWsdlLoader( iface )
    }
       
    loader.saveDefinition( "folder to saver to" )


    How does that work?

    regards,

    /Ole
    eviware.com