01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
11: */
12:
13: package com.eviware.soapui.impl.wsdl;
14:
15: import com.eviware.soapui.model.iface.Response;
16: import com.eviware.soapui.support.TestCaseWithJetty;
17:
18: public class WsdlRequestTestCase extends TestCaseWithJetty {
19: public void testRequest() throws Exception {
20: // create new project
21: WsdlProject project = new WsdlProject();
22:
23: // import amazon wsdl
24: WsdlInterface iface = project.importWsdl(
25: "http://127.0.0.1:8082/test1/TestService.wsdl", true)[0];
26:
27: // get "Help" operation
28: WsdlOperation operation = (WsdlOperation) iface
29: .getOperationByName("GetPage");
30:
31: // create a new empty request for that operation
32: WsdlRequest request = operation.addNewRequest("My request");
33:
34: // generate the request content from the schema
35: request.setRequestContent(operation.createRequest(true));
36:
37: // submit the request
38: WsdlSubmit submit = (WsdlSubmit) request.submit(
39: new WsdlSubmitContext(null), false);
40:
41: // wait for the response
42: Response response = submit.getResponse();
43:
44: // print the response
45: // String content = response.getContentAsString();
46: // System.out.println( content );
47: // assertNotNull( content );
48: }
49: /*
50: public void testMemory() throws Exception
51: {
52: try
53: {
54: // create new project
55: for( int c = 0; c < 100; c++ )
56: {
57: String url = "http://localhost:8082/soapui-tests/test1/TestService.wsdl";
58: // WsdlContext context = new WsdlContext( url, SoapVersion.Soap11, null, null );
59: // context.load();
60:
61: WsdlProject project = new WsdlProject();
62: // WsdlInterface iface = WsdlImporter.getInstance().importWsdl( project, url )[0];
63: // project.removeInterface( iface );
64:
65: // import amazon wsdl
66: project.importWsdl( url, false );
67: // project.release();
68: // project.removeInterface( iface );
69: // project.release();
70:
71: // get "Help" operation
72: // WsdlOperation operation = (WsdlOperation) iface.getOperationByName( "GetPage" );
73:
74: // create a new empty request for that operation
75: // WsdlRequest request = operation.addNewRequest( "My request" );
76:
77: System.out.println( "run " + c );
78: }
79:
80: assertTrue( true );
81: }
82: catch (RuntimeException e)
83: {
84: UISupport.logError( e );
85: assertTrue( false );
86: }
87: }*/
88: }
|