1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.actions.project;
14
15 import com.eviware.soapui.impl.WsdlInterfaceFactory;
16 import com.eviware.soapui.impl.wsdl.WsdlProject;
17 import com.eviware.soapui.model.iface.Interface;
18 import com.eviware.soapui.support.UISupport;
19 import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
20
21 /***
22 * Adds a WsdlInterface to a WsdlProject from a URL
23 *
24 * @author Ole.Matzura
25 */
26
27 public class AddInterfaceActionFromURL extends AbstractSoapUIAction<WsdlProject>
28 {
29 public static final String SOAPUI_ACTION_ID = "AddInterfaceActionFromURL";
30
31 public AddInterfaceActionFromURL()
32 {
33 super( "Add WSDL from URL", "Adds all interfaces in a specified WSDL URL to the current project" );
34 }
35
36 public void perform( WsdlProject project, Object param )
37 {
38 String url = UISupport.prompt( "Enter WSDL URL", "Add WSDL from URL", "" );
39 if( url == null )
40 return;
41
42 try
43 {
44 Boolean createRequests = UISupport.confirmOrCancel( "Create default requests for all operations",
45 "Import WSDL" );
46 if( createRequests == null )
47 return;
48
49 Interface[] ifaces = WsdlInterfaceFactory.importWsdl( project, url, createRequests );
50 if( ifaces != null && ifaces.length > 0 )
51 UISupport.select( ifaces[0] );
52 }
53 catch( Exception ex )
54 {
55 UISupport.showErrorMessage( ex.getMessage() + ":" + ex.getCause() );
56 }
57 }
58 }