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 ) return;
40
41 try
42 {
43 Boolean createRequests = UISupport.confirmOrCancel( "Create default requests for all operations", "Import WSDL" );
44 if( createRequests == null )
45 return;
46
47 Interface[] ifaces = WsdlInterfaceFactory.importWsdl( project,url, createRequests);
48 if (ifaces != null && ifaces.length > 0)
49 UISupport.select(ifaces[0]);
50 }
51 catch (Exception ex)
52 {
53 UISupport.showErrorMessage( ex.getMessage() + ":" + ex.getCause() );
54 }
55 }
56 }