1   /*
2    *  soapUI, copyright (C) 2004-2007 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
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  
14  package com.eviware.soapui.impl.wsdl;
15  
16  import com.eviware.soapui.model.iface.Response;
17  import com.eviware.soapui.support.TestCaseWithJetty;
18  
19  public class WsdlRequestTestCase extends TestCaseWithJetty
20  {
21  	public void testRequest() throws Exception
22  	{
23  		//	 create new project
24  		WsdlProject project = new WsdlProject();
25  
26  		// import amazon wsdl
27  		WsdlInterface iface = project.importWsdl( "http://127.0.0.1:8082/test1/TestService.wsdl", true )[0];
28  
29  		// get "Help" operation
30  		WsdlOperation operation = (WsdlOperation) iface.getOperationByName( "GetPage" );
31  
32  		// create a new empty request for that operation
33  		WsdlRequest request = operation.addNewRequest( "My request" );
34  
35  		// generate the request content from the schema
36  		request.setRequestContent( operation.createRequest( true ) );
37  
38  		// submit the request
39  		WsdlSubmit submit = (WsdlSubmit) request.submit( 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  }