Search in sources :

Example 6 with PortNames

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

the class ComponentBuilder method populateComponent.

private ServiceInfo populateComponent(ServiceInfo component, Service service) {
    QName qName = service.getQName();
    String namespace = qName.getNamespaceURI();
    String name = qName.getLocalPart();
    component.setServerName(name);
    component.setServerNameSpace(namespace);
    Map ports = service.getPorts();
    Iterator portIter = ports.values().iterator();
    while (portIter.hasNext()) {
        Port port = (Port) portIter.next();
        Binding binding = port.getBinding();
        if (port.getName() != null && component.getPortNames() == null) {
            List<PortNames> portNames = new ArrayList();
            PortNames portName = new PortNames();
            portName.setPortName(port.getName());
            portNames.add(portName);
            component.setPortNames(portNames);
        } else if (port.getName() != null && component.getPortNames() != null) {
            PortNames portName = new PortNames();
            portName.setPortName(port.getName());
            component.getPortNames().add(portName);
        }
        List operations = buildOperations(binding);
        Iterator operIter = operations.iterator();
        while (operIter.hasNext()) {
            OperationInfo operation = (OperationInfo) operIter.next();
            Vector addrElems = findExtensibilityElement(port.getExtensibilityElements(), "address");
            ExtensibilityElement element = (ExtensibilityElement) addrElems.elementAt(0);
            if (element != null && element instanceof SOAPAddress) {
                SOAPAddress soapAddr = (SOAPAddress) element;
                operation.setTargetURL(soapAddr.getLocationURI());
            } else if (element != null && element instanceof SOAP12Address) {
                SOAP12Address soapAddr = (SOAP12Address) element;
                operation.setTargetURL(soapAddr.getLocationURI());
            }
            component.addOperation(operation);
        }
    }
    return component;
}
Also used : SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) Binding(javax.wsdl.Binding) OperationInfo(org.talend.designer.webservice.ws.wsdlinfo.OperationInfo) QName(javax.xml.namespace.QName) Port(javax.wsdl.Port) ArrayList(java.util.ArrayList) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) PortNames(org.talend.designer.webservice.ws.wsdlinfo.PortNames) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) Vector(java.util.Vector) SOAP12Address(javax.wsdl.extensions.soap12.SOAP12Address)

Example 7 with PortNames

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

the class RepositoryWebService method getLastFunction.

private void getLastFunction() {
    //$NON-NLS-1$
    IElementParameter METHODPara = connector.getElementParameter("METHOD");
    Object obj = METHODPara.getValue();
    if (obj == null) {
        return;
    }
    if (obj instanceof String) {
        String str = (String) obj;
        //$NON-NLS-1$
        String wsdlUrl = (String) connector.getElementParameter("ENDPOINT").getValue();
        //$NON-NLS-1$
        String currentURL = (String) connector.getElementParameter("PORT_NAME").getValue();
        WSDLDiscoveryHelper ws = new WSDLDiscoveryHelper();
        List<Function> funList = new ArrayList<Function>();
        WebServiceComponent webServiceComponent = connector;
        boolean isUseProxy = webServiceComponent.getElementParameter("USE_PROXY").getValue().toString().equals("true");
        boolean isUseAuth = webServiceComponent.getElementParameter("NEED_AUTH").getValue().toString().equals("true");
        boolean isUseNTLM = webServiceComponent.getElementParameter("USE_NTLM").getValue().toString().equals("true");
        boolean isUseSSL = webServiceComponent.getElementParameter("NEED_SSL_TO_TRUSTSERVER").getValue().toString().equals("true");
        if (isUseProxy) {
            useProxy();
        }
        if (isUseAuth && !isUseNTLM) {
            useAuth();
        }
        if (isUseSSL) {
            useSSL();
        }
        if (serverConfig != null) {
            if (wsdlUrl != null && !wsdlUrl.contains("\"")) {
                funList = ws.getFunctionsAvailable(parseContextParameter(wsdlUrl), serverConfig);
            } else {
                funList = ws.getFunctionsAvailable(wsdlUrl, serverConfig);
            }
        } else {
            if (wsdlUrl != null && !wsdlUrl.contains("\"")) {
                funList = ws.getFunctionsAvailable(parseContextParameter(wsdlUrl));
            } else {
                funList = ws.getFunctionsAvailable(wsdlUrl);
            }
        }
        PortNames retrivePortName = new PortNames();
        retrivePortName.setPortName(currentURL);
        allPortNames.clear();
        allPortNames.add(retrivePortName);
        for (Function fun : funList) {
            if (fun.getName().equals(str)) {
                allfunList.clear();
                allfunList.add(fun);
                if (fun != null) {
                    currentFunction = fun;
                }
                return;
            }
        }
    }
}
Also used : Function(org.talend.designer.webservice.ws.wsdlinfo.Function) PortNames(org.talend.designer.webservice.ws.wsdlinfo.PortNames) WSDLDiscoveryHelper(org.talend.designer.webservice.ws.WSDLDiscoveryHelper) WebServiceComponent(org.talend.designer.webservice.WebServiceComponent) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter)

Aggregations

PortNames (org.talend.designer.webservice.ws.wsdlinfo.PortNames)7 Function (org.talend.designer.webservice.ws.wsdlinfo.Function)6 ArrayList (java.util.ArrayList)5 List (java.util.List)3 IElementParameter (org.talend.core.model.process.IElementParameter)3 WebServiceComponent (org.talend.designer.webservice.WebServiceComponent)3 Iterator (java.util.Iterator)2 Map (java.util.Map)2 WSDLDiscoveryHelper (org.talend.designer.webservice.ws.WSDLDiscoveryHelper)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 Vector (java.util.Vector)1 Binding (javax.wsdl.Binding)1 Port (javax.wsdl.Port)1 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)1 UnknownExtensibilityElement (javax.wsdl.extensions.UnknownExtensibilityElement)1 SOAPAddress (javax.wsdl.extensions.soap.SOAPAddress)1 SOAPBinding (javax.wsdl.extensions.soap.SOAPBinding)1 SOAP12Address (javax.wsdl.extensions.soap12.SOAP12Address)1 SOAP12Binding (javax.wsdl.extensions.soap12.SOAP12Binding)1