Many of the classes in soapUI can be used directly in other programs, for example if you want to set up requests and/or TestCases manually.
The following code is taken from the WsdlRequestTestCase and illustrates how to create a project, import a WSDL, create a request and submit it:
// create new project WsdlProject project = new WsdlProject(); // import amazon wsdl WsdlInterface iface = WsdlInterfaceFactory.importWsdl( "http://www.mycorp.com/somewsdl.wsdl", true ); // get desired operation WsdlOperation operation = (WsdlOperation) iface.getOperationByName( "MyOperation" ); // create a new empty request for that operation WsdlRequest request = operation.addNewRequest( "My request" ); // generate the request content from the schema request.setRequestContent( operation.createRequest( true ) ); // submit the request WsdlSubmit submit = (WsdlSubmit) request.submit( new WsdlSubmitContext(), false ); // wait for the response Response response = submit.getResponse(); // print the response String content = response.getContentAsString(); System.out.println( content ); assertNotNull( content ); assertTrue( content.indexOf( "404 Not Found" ) > 0 );
For this to work you will need the same dependencies as the soapUI maven plugin, download the source and have a look at the dependencies in src/maven-soapui-plugin/project.xml.
Regarding the LGPL License
The LGPL license allows you to do the following things with soapUI:
- Use soapUI as a component of your development process in any way you wish
- Make unlimited copies of soapUI without payment of royalties or license fees.
- Distribute copies of soapUI, although it would be much easier to refer anyone who wants copies directly to our web site
- Make changes to soapUI if you need to do so for use within your own company. The LGPL license does not require you to share those internal changes with the rest of the community.
- Distribute changed versions of soapUI to others, but if you distribute such changed versions you are required to share those changes with the rest of the community by publishing that changed source code under the LGPL.