Search in sources :

Example 1 with ServiceInfo

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

the class AllTypeDialog method init.

private void init() throws Exception {
    labelAndNameSpaceMap.clear();
    URLValue = TalendTextUtils.removeQuotes(URLValue);
    ComponentBuilder builder = new ComponentBuilder();
    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setWsdlUri(URLValue);
    serviceInfo.setAuthConfig(serverConfig);
    serviceInfo = builder.buildserviceinformation(serviceInfo);
    allXmlSchemaType = builder.getAllXmlSchemaType();
    allXmlSchemaElement = builder.getAllXmlSchemaElement();
    initSimpleType();
    initComplexType();
    allXMLSchemaTypeName = new String[allXmlSchemaType.size() + allXMLSimpleTypeName.length];
    for (int i = 0; i < allXMLSimpleTypeName.length; i++) {
        allXMLSchemaTypeName[i] = allXMLSimpleTypeName[i];
    }
    for (int i = allXMLSimpleTypeName.length; i < allXmlSchemaType.size() + allXMLSimpleTypeName.length; i++) {
        allXMLSchemaTypeName[i] = COMPLEXTYPE + allXmlSchemaType.get(i - allXMLSimpleTypeName.length).getName();
    }
}
Also used : ServiceInfo(org.talend.designer.webservice.ws.wsdlinfo.ServiceInfo) ComponentBuilder(org.talend.designer.webservice.ws.wsdlutil.ComponentBuilder)

Example 2 with ServiceInfo

use of org.talend.designer.webservice.ws.wsdlinfo.ServiceInfo 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;
}
Also used : ServiceInfo(org.talend.designer.webservice.ws.wsdlinfo.ServiceInfo) OperationInfo(org.talend.designer.webservice.ws.wsdlinfo.OperationInfo) Function(org.talend.designer.webservice.ws.wsdlinfo.Function) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo) ComponentBuilder(org.talend.designer.webservice.ws.wsdlutil.ComponentBuilder)

Aggregations

ServiceInfo (org.talend.designer.webservice.ws.wsdlinfo.ServiceInfo)2 ComponentBuilder (org.talend.designer.webservice.ws.wsdlutil.ComponentBuilder)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Function (org.talend.designer.webservice.ws.wsdlinfo.Function)1 OperationInfo (org.talend.designer.webservice.ws.wsdlinfo.OperationInfo)1 ParameterInfo (org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)1