1   /*
2    *  soapui, copyright (C) 2005 Ole Matzura / eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of the GNU Lesser General Public License as published by the Free Software Foundation; 
6    *  either version 2.1 of the License, or (at your option) any later version.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  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  {
20  	public void testRequest() throws Exception
21  	{
22  		//	 create new project
23  		WsdlProject project = new WsdlProject();
24  
25  		// import amazon wsdl
26  		WsdlInterface iface = project.importWsdl( "http://127.0.0.1:8082/test1/TestService.wsdl", true )[0];
27  
28  		// get "Help" operation
29  		WsdlOperation operation = (WsdlOperation) iface.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( new WsdlSubmitContext( null ), false );
39  
40  		// wait for the response
41  		Response response = submit.getResponse();
42  
43  		//	print the response
44  //		String content = response.getContentAsString();
45  //		System.out.println( content );
46  //		assertNotNull( content );
47  	}
48  	/*
49  	public void testMemory() throws Exception
50  	{
51  		try
52  		{
53  //			create new project
54  			for( int c = 0; c < 100; c++ )
55  			{
56  				String url = "http://localhost:8082/soapui-tests/test1/TestService.wsdl";
57  //				WsdlContext context = new WsdlContext( url, SoapVersion.Soap11, null, null );
58  //				context.load();
59  				
60  				WsdlProject project = new WsdlProject();
61  //				WsdlInterface iface = WsdlImporter.getInstance().importWsdl( project, url )[0];
62  //				project.removeInterface( iface );
63  				
64  				// import amazon wsdl
65  			   project.importWsdl( url, false );
66  		//	   project.release();
67  		//	   project.removeInterface( iface );
68  		//	   project.release();
69  				
70  				//		 get "Help" operation
71  //			WsdlOperation operation = (WsdlOperation) iface.getOperationByName( "GetPage" );
72  				
73  				//		 create a new empty request for that operation
74  //			WsdlRequest request = operation.addNewRequest( "My request" );	
75  				
76  				System.out.println( "run " + c );
77  			}
78  			
79  			assertTrue( true );
80  		} 
81  		catch (RuntimeException e)
82  		{
83  			e.printStackTrace();
84  			assertTrue( false );
85  		}
86  	}*/
87  }