Search in sources :

Example 1 with Function

use of org.talend.designer.esb.webservice.ws.wsdlinfo.Function in project tesb-studio-se by Talend.

the class WebServiceUIPresenter method retrieveData.

public void retrieveData(String wsdlLocation) throws WSDLException, InvocationTargetException {
    String wsdlLocationTemp = TalendQuoteUtils.removeQuotesIfExist(wsdlLocation);
    Definition definition = nodeAdapter.generateDefinition(wsdlLocationTemp);
    currentSetting.setWsdlLocation(TalendQuoteUtils.addQuotes(wsdlLocationTemp));
    currentSetting.setDefinition(definition);
    List<Function> functionsAvailable = new ArrayList<Function>();
    boolean hasRpcOperation = false;
    for (ServiceInfo serviceInfo : ComponentBuilder.buildModel(definition)) {
        if (serviceInfo.isHasRpcOperation()) {
            hasRpcOperation = true;
        }
        for (OperationInfo oper : serviceInfo.getOperations()) {
            Function f = new Function(serviceInfo, oper);
            functionsAvailable.add(f);
        }
    }
    currentSetting.setHasRcpOperation(hasRpcOperation);
    portFunctionsMap = new LinkedHashMap<String, List<Function>>();
    for (Function f : functionsAvailable) {
        List<Function> functions = portFunctionsMap.get(f.getPortName());
        if (functions == null) {
            functions = new ArrayList<Function>();
            portFunctionsMap.put(f.getPortName(), functions);
        }
        functions.add(f);
    }
}
Also used : ServiceInfo(org.talend.designer.esb.webservice.ws.wsdlinfo.ServiceInfo) OperationInfo(org.talend.designer.esb.webservice.ws.wsdlinfo.OperationInfo) Function(org.talend.designer.esb.webservice.ws.wsdlinfo.Function) Definition(javax.wsdl.Definition) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with Function

use of org.talend.designer.esb.webservice.ws.wsdlinfo.Function in project tesb-studio-se by Talend.

the class TESBConsumerNodeAdapter method loadCurrentFunction.

@Override
public Function loadCurrentFunction() {
    String operationName = node.getParamStringValue(METHOD);
    if (operationName == null) {
        return null;
    }
    String portName = node.getParamStringValue(PORT_NAME);
    if (portName == null) {
        return null;
    }
    String serviceName = node.getParamStringValue(SERVICE_NAME);
    String targetNamespace = node.getParamStringValue(SERVICE_NS);
    if (serviceName == null || targetNamespace == null) {
        return null;
    }
    QName serviceQName = new QName(targetNamespace, serviceName);
    return new Function(operationName, portName, serviceQName);
}
Also used : Function(org.talend.designer.esb.webservice.ws.wsdlinfo.Function) QName(javax.xml.namespace.QName)

Example 3 with Function

use of org.talend.designer.esb.webservice.ws.wsdlinfo.Function in project tesb-studio-se by Talend.

the class WebServiceUIPresenter method initWithCurrentSetting.

void initWithCurrentSetting() {
    Function function = nodeAdapter.loadCurrentFunction();
    if (function != null) {
        String port = function.getPortName();
        currentSetting.setPort(port);
        currentSetting.setFunction(function);
        functionTableModel.add(function);
        portTableModel.add(port);
        portFunctionsMap = Collections.singletonMap(port, Collections.singletonList(function));
    }
}
Also used : Function(org.talend.designer.esb.webservice.ws.wsdlinfo.Function)

Example 4 with Function

use of org.talend.designer.esb.webservice.ws.wsdlinfo.Function in project tesb-studio-se by Talend.

the class CSOAPNodeAdapter method loadCurrentFunction.

@Override
public Function loadCurrentFunction() {
    String operationName = node.getParamStringValue(OPERATION_NAME);
    if (operationName == null) {
        return null;
    }
    operationName = getExpressionParamValue(operationName);
    String portName = node.getParamStringValue(PORT_NAME);
    if (portName == null) {
        return null;
    }
    portName = getExpressionParamValue(portName);
    portName = portName.substring(portName.indexOf('}') + 1);
    portName = TalendQuoteUtils.removeQuotes(portName);
    String serviceName = node.getParamStringValue(SERVICE_NAME);
    // String targetNamespace = node.getParamStringValue(SERVICE_NS);
    if (serviceName == null) /* || targetNamespace == null */
    {
        return null;
    }
    QName serviceQName = QName.valueOf(serviceName);
    return new Function(operationName, portName, serviceQName);
}
Also used : Function(org.talend.designer.esb.webservice.ws.wsdlinfo.Function) QName(javax.xml.namespace.QName)

Example 5 with Function

use of org.talend.designer.esb.webservice.ws.wsdlinfo.Function in project tesb-studio-se by Talend.

the class CSOAPNodeAdapter method setNodeSetting.

@Override
public IStatus setNodeSetting(ServiceSetting setting) {
    Function currentFunction = setting.getFunction();
    node.setParamValue("WSDL_FILE", setting.getWsdlLocation());
    String operationName = currentFunction.getName();
    operationName = operationName.substring(0, operationName.indexOf('('));
    String fullOperationName = "{" + currentFunction.getNameSpaceURI() + "}" + operationName;
    node.setParamValue(OPERATION_NAME, TalendTextUtils.addQuotes(fullOperationName));
    String fullServiceName = "{" + currentFunction.getServiceNameSpace() + "}" + currentFunction.getServiceName();
    node.setParamValue(SERVICE_NAME, TalendTextUtils.addQuotes(fullServiceName));
    String fullPortName = "{" + currentFunction.getServiceNameSpace() + "}" + currentFunction.getPortName();
    node.setParamValue(PORT_NAME, TalendTextUtils.addQuotes(fullPortName));
    final String endpoint = node.getParamStringValue("ADDRESS");
    if (endpoint == null || !endpoint.startsWith("context.")) {
        node.setParamValue("ADDRESS", TalendTextUtils.addQuotes(currentFunction.getAddressLocation()));
    }
    IRepositoryViewObject resourceNode = setting.getResourceNode();
    if (resourceNode != null) {
        final Item item = resourceNode.getProperty().getItem();
        String id = item.getProperty().getId();
        node.setParamValue("WSDL_FILE_REPO:ROUTE_RESOURCE_TYPE_ID", id);
        node.setParamValue("WSDL_FILE_REPO:ROUTE_RESOURCE_TYPE_VERSION", item.getProperty().getVersion());
        String classpathUrl = RouteResourcesHelper.getClasspathUrl(item);
        if (classpathUrl != null) {
            node.setParamValue("WSDL_FILE_REPO:ROUTE_RESOURCE_TYPE_RES_URI", classpathUrl);
        }
    }
    return Status.OK_STATUS;
}
Also used : Function(org.talend.designer.esb.webservice.ws.wsdlinfo.Function) Item(org.talend.core.model.properties.Item) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Aggregations

Function (org.talend.designer.esb.webservice.ws.wsdlinfo.Function)6 QName (javax.xml.namespace.QName)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Definition (javax.wsdl.Definition)1 Item (org.talend.core.model.properties.Item)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 OperationInfo (org.talend.designer.esb.webservice.ws.wsdlinfo.OperationInfo)1 ServiceInfo (org.talend.designer.esb.webservice.ws.wsdlinfo.ServiceInfo)1