Forum Discussion

pauldaviesuk's avatar
pauldaviesuk
New Contributor
16 years ago

SoapUI API dependencies

Hi all,

I'm trying to use the SopaUI api to write an automated test fro a Groovy/Grails application that acts as a mock for a web service.

The mock app needs to generate soap as if it had come from the real we service. I need to write a simple test that will take the soap output from the mock and validate it against the WSDL that the web service is built from in much the same way as if I had called the mock from the SoapUI app and clicked Aly-V.

So farm the test looks like this:
        WsdlInterface iface = WsdlInterfaceFactory.importWsdl(new WsdlProject(), "http://localhost:8080/wsapp/wsdl/wsapp.wsdl", true )[0];
        WsdlOperation operation = (WsdlOperation) iface.getOperationByName( "getStatusUpdate" );
        WsdlRequest request = operation.addNewRequest( "My request" );
        request.setEndpoint("http://localhost:8080/wsmockapp/StatusUpdate/getresponselist");
        request.setRequestContent( operation.createRequest( true ) );
        WsdlSubmit submit = (WsdlSubmit) request.submit( new WsdlSubmitContext(), false );
        Response response = submit.getResponse();
        String content = response.getContentAsString();
        System.out.println( content );
        assertNotNull( content );
        assertTrue( content.indexOf( "404 Not Found" ) > 0  );


not much of a test, but its a start.

My problem is with the dependent jars needed to get this to compile. In order to get that code to compile, I need to add soapui-3.0.1.jar to the lib dir. When I run the test, I'm getting a series of 'NoClassDefFoundError' exceptions for various classes. I'm gradually working through these adding jars as required. So far I've added these:

xbean-fixed-2.4.0.jar
soapui-xmlbeans-3.0.1.jar
soapui-3.0.1.jar

My problem is that I'm now getting this exception:
java.lang.NoClassDefFoundError: com/eviware/soapui/impl/wsdl/support/wsdl/WsdlLoader


Unfortunately, the 'missing' class is in shoule be visible as its in soapui-3.0.1.jar. I can't very well add it again, so i'm wandering if the its actually complaining about something else.

The useful part of the stacktrace is :

java.lang.NoClassDefFoundError: com/eviware/soapui/impl/wsdl/support/wsdl/WsdlLoader
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
at java.lang.Class.getDeclaredMethods(Class.java:1763)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:33)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:20)
at org.test.WsMockapp.WsMockappSOAPValidationTests.testStatusUpdateSoap(WsMockappSOAPValidationTests.groovy:28)
....

which corresponds to the line:
WsdlInterface iface = WsdlInterfaceFactory.importWsdl(new WsdlProject(), "http://localhost:8080/wsapp/wsdl/wsapp.wsdl", true )[0];



TIA for any thoughts on this

cheers

Paul
No RepliesBe the first to reply