use of org.talend.designer.webservice.ws.wsdlinfo.Function in project tdi-studio-se by Talend.
the class WebServiceDialog method nextPressed.
protected void nextPressed() {
tabFolder = webServiceUI.getTabFolder();
Function function = webServiceUI.getCurrentFunction();
int curreSelect = tabFolder.getSelectionIndex();
if (function == null) {
warningDialog("Please Select a Operation!");
} else if (curreSelect < 2 && function != null) {
if (webServiceUI.getIsFirst()) {
webServiceUI.initWebserviceData();
}
tabFolder.setSelection(curreSelect + 1);
if (!backButton.getEnabled()) {
backButton.setEnabled(true);
}
if ((curreSelect + 1) == 2) {
nextButton.setEnabled(false);
}
webServiceUI.refreshTableView();
}
}
use of org.talend.designer.webservice.ws.wsdlinfo.Function in project tdi-studio-se by Talend.
the class RepositoryWebService method addListenerForWSDLCom.
private void addListenerForWSDLCom() {
refreshbut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell().getShell());
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) {
//$NON-NLS-1$
monitor.beginTask("Retrieve WSDL parameter from net.", IProgressMonitor.UNKNOWN);
Display.getDefault().syncExec(new Runnable() {
public void run() {
getDataFromNet();
}
});
monitor.done();
}
};
try {
progressDialog.run(true, true, runnable);
} catch (InvocationTargetException e1) {
ExceptionHandler.process(e1);
} catch (InterruptedException e1) {
ExceptionHandler.process(e1);
} catch (WebServiceCancelException e1) {
return;
}
if (currentPortName != null) {
connection.setPortName(currentPortName.getPortName());
} else if (currentPortName == null && allPortNames != null) {
currentPortName = allPortNames.get(0);
connection.setPortName(currentPortName.getPortName());
}
listTable.setSelection(listTable.getItem(0));
if (currentFunction != null) {
connection.setMethodName(currentFunction.getName());
connection.setServerNameSpace(currentFunction.getServerNameSpace());
connection.setServerName(currentFunction.getServerName());
connection.setPortNameSpace(currentFunction.getServerNameSpace());
}
// listTable.select(0);
isFirst = false;
}
});
// TableItem firstItem = listTable.getItem(0);
// currentFunction = firstItem.getData();
listTable = listTableView.getTable();
portListTable = portListTableView.getTable();
listTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] item = listTable.getSelection();
currentFunction = (Function) item[0].getData();
if (currentFunction != null) {
connection.setServerName(currentFunction.getServerName());
connection.setServerNameSpace(currentFunction.getServerNameSpace());
connection.setMethodName(currentFunction.getName());
}
// if select the same as before ,don't change it
// IElementParameter METHODPara = connector.getElementParameter("METHOD"); //$NON-NLS-1$
// Object obj = METHODPara.getValue();
// if (currentFunction.getName().equals(obj.toString())) {
// return;
// }
List<ParameterInfo> listIn = currentFunction.getInputParameters();
List<ParameterInfo> listOut = currentFunction.getOutputParameters();
}
});
portListTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] item = portListTable.getSelection();
currentPortName = (PortNames) item[0].getData();
connection.setPortName(currentPortName.getPortName());
}
});
}
use of org.talend.designer.webservice.ws.wsdlinfo.Function in project tdi-studio-se by Talend.
the class RepositoryWebService method ctrate.
public void ctrate() {
wsdlComposite = new Composite(uiParent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = 20;
layout.marginHeight = 20;
wsdlComposite.setLayout(layout);
wsdlComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
// WSDL URL
Composite wsdlUrlcomposite = new Composite(wsdlComposite, SWT.NONE);
GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.verticalIndent = 2;
layoutData.verticalSpan = 1;
wsdlUrlcomposite.setLayoutData(layoutData);
layout = new GridLayout(4, false);
wsdlUrlcomposite.setLayout(layout);
wsdlField = new LabelledFileField(wsdlUrlcomposite, ExternalWebServiceUIProperties.FILE_LABEL, ExternalWebServiceUIProperties.FILE_EXTENSIONS, 1, SWT.BORDER) {
@Override
protected void setFileFieldValue(String result) {
if (result != null) {
getTextControl().setText(TalendTextUtils.addQuotes(PathUtils.getPortablePath(result)));
getDataFromNet();
isFirst = false;
}
}
};
wsdlField.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// TODO Auto-generated method stub
URLValue = wsdlField.getText();
connection.setWSDL(URLValue);
}
});
// add a listener for ctrl+space.
TalendProposalUtils.installOn(wsdlField.getTextControl(), connector.getProcess(), connector);
//$NON-NLS-1$
String wsdlUrl = (String) connector.getElementParameter("ENDPOINT").getValue();
if (wsdlUrl != null) {
wsdlField.setText(wsdlUrl);
}
refreshbut = new Button(wsdlUrlcomposite, SWT.PUSH | SWT.CENTER);
refreshbut.setImage(ImageProvider.getImage(EImage.REFRESH_ICON));
GridData butData = new GridData();
butData.verticalSpan = 1;
refreshbut.setLayoutData(butData);
// add port name UI
Composite wsdlPortcomposite = new Composite(wsdlComposite, SWT.NONE);
GridData portlayoutData = new GridData(GridData.FILL_HORIZONTAL);
portlayoutData.verticalIndent = 2;
portlayoutData.verticalSpan = 3;
wsdlPortcomposite.setLayoutData(portlayoutData);
layout = new GridLayout(2, false);
layout.verticalSpacing = 1;
wsdlPortcomposite.setLayout(layout);
portNameLabel = new Label(wsdlPortcomposite, SWT.NONE);
//$NON-NLS-1$
portNameLabel.setText(Messages.getString("WebServiceUI.Port"));
GridData portLabelGridData = new GridData();
portLabelGridData.verticalAlignment = SWT.TOP;
portNameLabel.setLayoutData(portLabelGridData);
Composite portTabComposite = new Composite(wsdlPortcomposite, SWT.BORDER);
portTabComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
portTabComposite.setLayout(new FillLayout());
//$NON-NLS-1$
ExtendedTableModel<PortNames> portModel = new ExtendedTableModel<PortNames>("PORTNAMELIST", allPortNames);
portListTableView = new AbstractDataTableEditorView<PortNames>(portTabComposite, SWT.NONE, portModel, false, true, false) {
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<PortNames> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setHeaderVisible(false);
newTableViewerCreator.setVerticalScroll(true);
newTableViewerCreator.setReadOnly(true);
}
@Override
protected void createColumns(TableViewerCreator<PortNames> tableViewerCreator, Table table) {
TableViewerCreatorColumn rowColumn = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
rowColumn.setTitle(Messages.getString("WebServiceUI.COLUMN"));
rowColumn.setBeanPropertyAccessors(new IBeanPropertyAccessors<PortNames, String>() {
public String get(PortNames bean) {
return bean.getPortName();
}
public void set(PortNames bean, String value) {
bean.setPortName(value);
}
});
rowColumn.setWeight(60);
rowColumn.setModifiable(true);
rowColumn.setMinimumWidth(60);
rowColumn.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
}
};
// WSDL Operation
Composite wsdlOperationcomposite = new Composite(wsdlComposite, SWT.NONE);
GridData operationlayoutData = new GridData(GridData.FILL_BOTH);
operationlayoutData.verticalIndent = 2;
operationlayoutData.verticalSpan = 5;
wsdlOperationcomposite.setLayoutData(operationlayoutData);
layout = new GridLayout(2, false);
layout.verticalSpacing = 3;
wsdlOperationcomposite.setLayout(layout);
// wsdlOperationcomposite.setLayoutData(new GridData(GridData.FILL_BOTH));
operationLabel = new Label(wsdlOperationcomposite, SWT.NONE);
//$NON-NLS-1$
operationLabel.setText(Messages.getString("WebServiceUI.Operation"));
GridData opertionLabelGridData = new GridData();
opertionLabelGridData.verticalAlignment = SWT.TOP;
operationLabel.setLayoutData(opertionLabelGridData);
Composite tabComposite = new Composite(wsdlOperationcomposite, SWT.BORDER);
GridData tabGridData = new GridData(GridData.FILL_BOTH);
// tabGridData.verticalSpan = 3;
tabComposite.setLayoutData(tabGridData);
tabComposite.setLayout(new FillLayout());
//$NON-NLS-1$
ExtendedTableModel<Function> funModel = new ExtendedTableModel<Function>("FUNCTIONLIST", allfunList);
listTableView = new AbstractDataTableEditorView<Function>(tabComposite, SWT.NONE, funModel, false, true, false) {
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<Function> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setHeaderVisible(false);
newTableViewerCreator.setVerticalScroll(true);
newTableViewerCreator.setReadOnly(true);
}
@Override
protected void createColumns(TableViewerCreator<Function> tableViewerCreator, Table table) {
TableViewerCreatorColumn rowColumn = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
rowColumn.setTitle(Messages.getString("WebServiceUI.COLUMN"));
rowColumn.setBeanPropertyAccessors(new IBeanPropertyAccessors<Function, String>() {
public String get(Function bean) {
return bean.getName();
}
public void set(Function bean, String value) {
bean.setName(value);
}
});
rowColumn.setWeight(60);
rowColumn.setModifiable(true);
rowColumn.setMinimumWidth(60);
rowColumn.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
}
};
addListenerForWSDLCom();
}
use of org.talend.designer.webservice.ws.wsdlinfo.Function in project tdi-studio-se by Talend.
the class WSDLDiscoveryHelper method getFunctionsAvailable.
/**
* DOC gcui Comment method "getFunctionsAvailable".
*
* @param wsdlURI
* @return
*/
public List<Function> getFunctionsAvailable(String wsdlURI, ServiceHelperConfiguration config) {
functionsAvailable = new ArrayList();
wsdlURI = TalendTextUtils.removeQuotes(wsdlURI);
try {
ComponentBuilder builder = new ComponentBuilder();
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setWsdlUri(wsdlURI);
serviceInfo.setAuthConfig(config);
serviceInfo = builder.buildserviceinformation(serviceInfo);
if (serviceInfo != null) {
Iterator iter = serviceInfo.getOperations();
while (iter.hasNext()) {
OperationInfo oper = (OperationInfo) iter.next();
// operationName
Function f = new Function(oper.getTargetMethodName());
String operationName = oper.getTargetMethodName() + "(";
if (serviceInfo.getServerName() != null) {
f.setServerName(serviceInfo.getServerName());
}
if (serviceInfo.getServerNameSpace() != null) {
f.setServerNameSpace(serviceInfo.getServerNameSpace());
}
if (serviceInfo.getPortNames() != null) {
f.setPortNames(serviceInfo.getPortNames());
}
if (oper.getSoapActionURI() != null) {
f.setSoapAction(oper.getSoapActionURI());
}
if (oper.getNamespaceURI() != null) {
f.setNameSpaceURI(oper.getNamespaceURI());
}
if (oper.getEncodingStyle() != null) {
f.setEncodingStyle(oper.getEncodingStyle());
}
if (oper.getTargetURL() != null) {
f.setAddressLocation(oper.getTargetURL());
}
List inps = oper.getInparameters();
List outps = oper.getOutparameters();
// input parameters
inputParameters = new ArrayList();
if (inps.size() == 0) {
inputParameters.add(new ParameterInfo());
operationName = operationName + "):";
} else if (inps.size() > 0 && inps != null) {
for (Iterator iterator1 = inps.iterator(); iterator1.hasNext(); ) {
ParameterInfo element = (ParameterInfo) iterator1.next();
getParaFullName(element);
// ParameterInfo p = new ParameterInfo();
// p.setType(element.getKind());
inputParameters.add(element);
if (element.getType() != null) {
operationName = operationName + element.getType() + ",";
} else if (element.getType() == null && element.getName() != null) {
operationName = operationName + element.getName() + ",";
} else if (element.getType() == null) {
operationName = operationName + "noType" + ",";
}
if (element.getType() == null && (element.getParameterInfos() == null || element.getParameterInfos().isEmpty()) && inps.size() == 1) {
element.setName(element.getName());
}
}
int operationNamelen = operationName.length();
operationName = operationName.substring(0, operationNamelen - 1) + "):";
f.setInputParameters(inputParameters);
}
// output parameters
outputParameters = new ArrayList();
if (outps.size() == 0) {
outputParameters.add(new ParameterInfo());
} else {
for (Iterator iterator2 = outps.iterator(); iterator2.hasNext(); ) {
ParameterInfo element = (ParameterInfo) iterator2.next();
getParaFullName(element);
// ParameterInfo p = new ParameterInfo();
// p.setType(element.getKind());
outputParameters.add(element);
if (element.getType() != null) {
operationName = operationName + element.getType() + ",";
} else if (element.getParameterInfos() != null && !element.getParameterInfos().isEmpty()) {
for (Object element2 : element.getParameterInfos()) {
ParameterInfo elementBranch = (ParameterInfo) element2;
if (elementBranch.getType() != null) {
operationName = operationName + elementBranch.getType() + ",";
} else {
operationName = operationName + "noType" + ",";
}
}
}
}
int operationNamelen = operationName.length();
operationName = operationName.substring(0, operationNamelen - 1);
f.setOutputParameters(outputParameters);
}
f.setName(operationName);
functionsAvailable.add(f);
}
}
} catch (Exception e) {
MessageBoxExceptionHandler.process(e);
}
return functionsAvailable;
}
use of org.talend.designer.webservice.ws.wsdlinfo.Function in project tdi-studio-se by Talend.
the class RepositoryWebService method getDataFromNet.
private void getDataFromNet() {
List<Function> funList = new ArrayList<Function>();
List<PortNames> portNameList = new ArrayList<PortNames>();
URLValue = wsdlField.getText();
if (URLValue == null) {
//$NON-NLS-1$
URLValue = "";
}
final WSDLDiscoveryHelper ws = new WSDLDiscoveryHelper();
WebServiceComponent webServiceComponent = connector;
boolean isUseProxy = webServiceComponent.getElementParameter("USE_PROXY").getValue().toString().equals("true");
boolean isUseNTLM = webServiceComponent.getElementParameter("USE_NTLM").getValue().toString().equals("true");
boolean isUseAuth = webServiceComponent.getElementParameter("NEED_AUTH").getValue().toString().equals("true");
if (isUseProxy) {
useProxy();
}
if (isUseAuth && !isUseNTLM) {
useAuth();
}
boolean isUseSSL = webServiceComponent.getElementParameter("NEED_SSL_TO_TRUSTSERVER").getValue().toString().equals("true");
if (isUseSSL) {
useSSL();
}
if (serverConfig != null) {
if (URLValue != null && !URLValue.contains("\"")) {
funList = ws.getFunctionsAvailable(parseContextParameter(URLValue), serverConfig);
} else {
funList = ws.getFunctionsAvailable(URLValue, serverConfig);
}
} else {
if (URLValue != null && !URLValue.contains("\"")) {
funList = ws.getFunctionsAvailable(parseContextParameter(URLValue));
} else {
funList = ws.getFunctionsAvailable(URLValue);
}
}
if (!funList.isEmpty()) {
if (funList.get(0) != null) {
if (funList.get(0).getPortNames() != null) {
portNameList = funList.get(0).getPortNames();
}
}
}
ExtendedTableModel<Function> listModel = listTableView.getExtendedTableModel();
ExtendedTableModel<PortNames> portListModel = portListTableView.getExtendedTableModel();
listModel.removeAll();
listModel.addAll(funList);
portListModel.removeAll();
portListModel.addAll(portNameList);
connection.setPortName(portNameList.get(0).getPortName());
}
Aggregations