use of org.eclipse.wst.ws.internal.explorer.LaunchOption in project liferay-ide by liferay.
the class TestWebServicesAction method run.
public void run(IAction action) {
if (selectedServer == null && selectedModule == null) {
// can't do anything if server has not been selected
return;
}
URL webServicesListURL = null;
String[] names = null;
WebServicesHelper helper = null;
if (selectedServer != null) {
ILiferayServer portalServer = (ILiferayServer) selectedServer.loadAdapter(ILiferayServer.class, null);
webServicesListURL = portalServer.getWebServicesListURL();
helper = new WebServicesHelper(webServicesListURL);
names = helper.getWebServiceNames();
} else if (selectedModule != null) {
selectedModule.getModule()[0].getProject();
ILiferayServer portalServer = (ILiferayServer) selectedModule.getServer().loadAdapter(ILiferayServer.class, null);
try {
webServicesListURL = // $NON-NLS-1$
new URL(portalServer.getPortalHomeUrl(), selectedModule.getModule()[0].getName() + "/axis");
} catch (MalformedURLException e) {
LiferayServerUI.logError(e);
return;
}
helper = new WebServicesHelper(webServicesListURL);
names = helper.getWebServiceNames();
if (ListUtil.isEmpty(names)) {
try {
webServicesListURL = // $NON-NLS-1$
new URL(portalServer.getPortalHomeUrl(), selectedModule.getModule()[0].getName() + "/api/axis");
} catch (MalformedURLException e) {
LiferayServerUI.logError(e);
return;
}
helper = new WebServicesHelper(webServicesListURL);
names = helper.getWebServiceNames();
}
}
StringsFilteredDialog dialog = new StringsFilteredDialog(getActiveShell());
dialog.setTitle(Msgs.webServiceSelection);
dialog.setMessage(Msgs.selectWebService);
dialog.setInput(names);
int retval = dialog.open();
if (retval == Window.OK) {
String serviceName = dialog.getFirstResult().toString();
String url = helper.getWebServiceWSDLURLByName(serviceName);
String stateLocation = ExplorerPlugin.getInstance().getPluginStateLocation();
String defaultFavoritesLocation = ExplorerPlugin.getInstance().getDefaultFavoritesLocation();
WSExplorerLauncherCommand command = new WSExplorerLauncherCommand();
command.setForceLaunchOutsideIDE(false);
Vector launchOptions = new Vector();
addLaunchOptions(launchOptions, url, stateLocation, defaultFavoritesLocation);
command.setLaunchOptions((LaunchOption[]) launchOptions.toArray(new LaunchOption[0]));
command.execute();
}
}
use of org.eclipse.wst.ws.internal.explorer.LaunchOption in project liferay-ide by liferay.
the class TestWebServicesAction method addLaunchOptions.
protected void addLaunchOptions(Vector launchOptions, String wsdlURL, String stateLocation, String defaultFavoritesLocation) {
GetMonitorCommand getMonitorCmd = new GetMonitorCommand();
getMonitorCmd.setMonitorService(true);
getMonitorCmd.setCreate(false);
getMonitorCmd.setWebServicesParser(new WebServicesParser());
getMonitorCmd.setWsdlURI(wsdlURL);
getMonitorCmd.execute(null, null);
List endpoints = getMonitorCmd.getEndpoints();
for (Iterator endpointsIt = endpoints.iterator(); endpointsIt.hasNext(); ) {
launchOptions.add(new LaunchOption(LaunchOptions.WEB_SERVICE_ENDPOINT, (String) endpointsIt.next()));
}
launchOptions.add(new LaunchOption(LaunchOptions.WSDL_URL, wsdlURL));
launchOptions.add(new LaunchOption(LaunchOptions.STATE_LOCATION, stateLocation));
launchOptions.add(new LaunchOption(LaunchOptions.DEFAULT_FAVORITES_LOCATION, defaultFavoritesLocation));
}
Aggregations