1 /* 2 * soapUI, copyright (C) 2004-2010 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.impl.WsdlInterfaceFactory; 17 import com.eviware.soapui.model.iface.Response; 18 import com.eviware.soapui.support.TestCaseWithJetty; 19 20 public class WsdlRequestTestCase extends TestCaseWithJetty 21 { 22 public void testRequest() throws Exception 23 { 24 // create new project 25 WsdlProject project = new WsdlProject(); 26 27 // import amazon wsdl 28 WsdlInterface iface = WsdlInterfaceFactory.importWsdl( project, "http://127.0.0.1:8082/test1/TestService.wsdl", true )[0]; 29 30 // get "Help" operation 31 WsdlOperation operation = (WsdlOperation) iface.getOperationByName( "GetPage" ); 32 33 // create a new empty request for that operation 34 WsdlRequest request = operation.addNewRequest( "My request" ); 35 36 // generate the request content from the schema 37 request.setRequestContent( operation.createRequest( true ) ); 38 39 // submit the request 40 WsdlSubmit submit = (WsdlSubmit) request.submit( new WsdlSubmitContext( request ), false ); 41 42 // wait for the response 43 Response response = submit.getResponse(); 44 45 // print the response 46 // String content = response.getContentAsString(); 47 // System.out.println( content ); 48 // assertNotNull( content ); 49 } 50 /* 51 public void testMemory() throws Exception 52 { 53 try 54 { 55 // create new project 56 for( int c = 0; c < 100; c++ ) 57 { 58 String url = "http://localhost:8082/soapui-tests/test1/TestService.wsdl"; 59 // WsdlContext context = new WsdlContext( url, SoapVersion.Soap11, null, null ); 60 // context.load(); 61 62 WsdlProject project = new WsdlProject(); 63 // WsdlInterface iface = WsdlImporter.getInstance().importWsdl( project, url )[0]; 64 // project.removeInterface( iface ); 65 66 // import amazon wsdl 67 project.importWsdl( url, false ); 68 // project.release(); 69 // project.removeInterface( iface ); 70 // project.release(); 71 72 // get "Help" operation 73 // WsdlOperation operation = (WsdlOperation) iface.getOperationByName( "GetPage" ); 74 75 // create a new empty request for that operation 76 // WsdlRequest request = operation.addNewRequest( "My request" ); 77 78 System.out.println( "run " + c ); 79 } 80 81 assertTrue( true ); 82 } 83 catch (RuntimeException e) 84 { 85 UISupport.logError( e ); 86 assertTrue( false ); 87 } 88 }*/ 89 }