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