Search in sources :

Example 1 with ServiceInfo

use of org.talend.designer.esb.webservice.ws.wsdlinfo.ServiceInfo 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 ServiceInfo

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

the class ComponentBuilder method populateComponent.

private static ServiceInfo populateComponent(Service service) {
    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setServiceName(service.getQName());
    Collection<Port> ports = service.getPorts().values();
    for (Port port : ports) {
        String soapLocation = null;
        SOAPAddress soapAddress = findExtensibilityElement(port.getExtensibilityElements(), SOAPAddress.class);
        if (null != soapAddress) {
            soapLocation = soapAddress.getLocationURI();
        } else {
            SOAP12Address soap12Address = findExtensibilityElement(port.getExtensibilityElements(), SOAP12Address.class);
            if (null != soap12Address) {
                soapLocation = soap12Address.getLocationURI();
            }
        }
        Binding binding = port.getBinding();
        for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) {
            SOAPOperation soapOperation = findExtensibilityElement(operation.getExtensibilityElements(), SOAPOperation.class);
            if (null != soapOperation && OPERATION_TYPE_RPC.equalsIgnoreCase(soapOperation.getStyle())) {
                // TESB-6151 disable display of unsupported RPC type.
                serviceInfo.setHasRpcOperation(true);
                continue;
            }
            OperationInfo operationInfo = new OperationInfo(operation.getOperation());
            operationInfo.setPortName(port.getName());
            operationInfo.setNamespaceURI(binding.getPortType().getQName().getNamespaceURI());
            if (soapOperation != null) {
                operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
            } else {
                SOAP12Operation soap12Operation = findExtensibilityElement(operation.getExtensibilityElements(), SOAP12Operation.class);
                if (soap12Operation != null) {
                    operationInfo.setSoapActionURI(soap12Operation.getSoapActionURI());
                }
            }
            operationInfo.setTargetURL(soapLocation);
            serviceInfo.addOperation(operationInfo);
        }
    }
    return serviceInfo;
}
Also used : ServiceInfo(org.talend.designer.esb.webservice.ws.wsdlinfo.ServiceInfo) Binding(javax.wsdl.Binding) OperationInfo(org.talend.designer.esb.webservice.ws.wsdlinfo.OperationInfo) BindingOperation(javax.wsdl.BindingOperation) SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) SOAP12Operation(javax.wsdl.extensions.soap12.SOAP12Operation) Port(javax.wsdl.Port) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) Collection(java.util.Collection) SOAP12Address(javax.wsdl.extensions.soap12.SOAP12Address)

Aggregations

OperationInfo (org.talend.designer.esb.webservice.ws.wsdlinfo.OperationInfo)2 ServiceInfo (org.talend.designer.esb.webservice.ws.wsdlinfo.ServiceInfo)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 Binding (javax.wsdl.Binding)1 BindingOperation (javax.wsdl.BindingOperation)1 Definition (javax.wsdl.Definition)1 Port (javax.wsdl.Port)1 SOAPAddress (javax.wsdl.extensions.soap.SOAPAddress)1 SOAPOperation (javax.wsdl.extensions.soap.SOAPOperation)1 SOAP12Address (javax.wsdl.extensions.soap12.SOAP12Address)1 SOAP12Operation (javax.wsdl.extensions.soap12.SOAP12Operation)1 Function (org.talend.designer.esb.webservice.ws.wsdlinfo.Function)1