Search in sources :

Example 6 with BindingOperation

use of javax.wsdl.BindingOperation 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)

Example 7 with BindingOperation

use of javax.wsdl.BindingOperation in project tesb-studio-se by Talend.

the class PublishMetadataRunnable method getAllPaths.

@SuppressWarnings("unchecked")
private Collection<String> getAllPaths() throws URISyntaxException {
    final Set<String> paths = new HashSet<String>();
    final Set<QName> portTypes = new HashSet<QName>();
    final Set<QName> alreadyCreated = new HashSet<QName>();
    for (Binding binding : (Collection<Binding>) wsdlDefinition.getAllBindings().values()) {
        final QName portType = binding.getPortType().getQName();
        if (portTypes.add(portType)) {
            for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) {
                Operation oper = operation.getOperation();
                Input inDef = oper.getInput();
                if (inDef != null) {
                    Message inMsg = inDef.getMessage();
                    addParamsToPath(portType, oper, inMsg, paths, alreadyCreated);
                }
                Output outDef = oper.getOutput();
                if (outDef != null) {
                    Message outMsg = outDef.getMessage();
                    addParamsToPath(portType, oper, outMsg, paths, alreadyCreated);
                }
                for (Fault fault : (Collection<Fault>) oper.getFaults().values()) {
                    Message faultMsg = fault.getMessage();
                    addParamsToPath(portType, oper, faultMsg, paths, alreadyCreated);
                }
            }
        }
    }
    return paths;
}
Also used : Binding(javax.wsdl.Binding) Message(javax.wsdl.Message) QName(javax.xml.namespace.QName) Fault(javax.wsdl.Fault) Operation(javax.wsdl.Operation) BindingOperation(javax.wsdl.BindingOperation) BindingOperation(javax.wsdl.BindingOperation) Input(javax.wsdl.Input) Output(javax.wsdl.Output) Collection(java.util.Collection) HashSet(java.util.HashSet)

Example 8 with BindingOperation

use of javax.wsdl.BindingOperation in project tesb-studio-se by Talend.

the class WSDLUtils method getServiceOperationParameters.

public static Map<String, String> getServiceOperationParameters(IFile wsdlURI, String operationName, String portTypeName) throws CoreException {
    // NOTE: all below in assuming standalone (no another WSDL's imports) WS-I complaint WSDL !
    Map<String, String> map = new HashMap<String, String>();
    if (null == wsdlURI) {
        // no WSDL provided
        return map;
    }
    Definition wsdl = getDefinition(wsdlURI);
    for (Object serviceObject : wsdl.getServices().values()) {
        Service service = (Service) serviceObject;
        for (Object portObject : service.getPorts().values()) {
            Port port = (Port) portObject;
            try {
                port.getBinding().getPortType().getQName().getLocalPart();
            } catch (NullPointerException npe) {
                throw getCoreException("WSDL is not consistent. Can not find portType operation description for current service.", npe);
            }
            if (portTypeName.equals(port.getBinding().getPortType().getQName().getLocalPart())) {
                final String targetNs = wsdl.getTargetNamespace();
                map.put(SERVICE_NAME, service.getQName().getLocalPart());
                map.put(SERVICE_NS, targetNs);
                map.put(PORT_NAME, port.getName());
                map.put(PORT_NS, targetNs);
                map.put(OPERATION_NAME, operationName);
                map.put(WSDL_LOCATION, wsdlURI.getLocation().toPortableString());
                BindingOperation bindingOperation = port.getBinding().getBindingOperation(operationName, null, null);
                if (null == bindingOperation) {
                    throw getCoreException("Operation '" + operationName + "' not found in binding", null);
                }
                map.put(COMMUNICATION_STYLE, null == bindingOperation.getBindingOutput() && bindingOperation.getBindingFaults().isEmpty() ? ONE_WAY : REQUEST_RESPONSE);
                String faults = null;
                for (Object fault : bindingOperation.getBindingFaults().keySet()) {
                    if (faults == null) {
                        faults = (String) fault;
                    } else {
                        faults += ',' + (String) fault;
                    }
                }
                map.put(FAULTS, faults);
                // map.put(OPERATION_NS, targetNs);
                map.put(ENDPOINT_URI, getPortAddress(port));
                break;
            }
        }
    }
    return map;
}
Also used : BindingOperation(javax.wsdl.BindingOperation) HashMap(java.util.HashMap) ServicePort(org.talend.repository.services.model.services.ServicePort) Port(javax.wsdl.Port) Definition(javax.wsdl.Definition) Service(javax.wsdl.Service) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 9 with BindingOperation

use of javax.wsdl.BindingOperation in project tdi-studio-se by Talend.

the class ComponentBuilder method buildOperations.

private List buildOperations(Binding binding) {
    List operationInfos = new ArrayList();
    List operations = binding.getBindingOperations();
    if (operations != null && !operations.isEmpty()) {
        Vector soapBindingElems = findExtensibilityElement(binding.getExtensibilityElements(), "binding");
        // default
        String style = "document";
        ExtensibilityElement soapBindingElem = (ExtensibilityElement) soapBindingElems.elementAt(0);
        if (soapBindingElem != null && soapBindingElem instanceof SOAPBinding) {
            SOAPBinding soapBinding = (SOAPBinding) soapBindingElem;
            style = soapBinding.getStyle();
        } else if (soapBindingElem != null && soapBindingElem instanceof SOAP12Binding) {
            SOAP12Binding soapBinding = (SOAP12Binding) soapBindingElem;
            style = soapBinding.getStyle();
        }
        Iterator opIter = operations.iterator();
        while (opIter.hasNext()) {
            alldExtendtion.clear();
            BindingOperation oper = (BindingOperation) opIter.next();
            Vector operElems = findExtensibilityElement(oper.getExtensibilityElements(), "operation");
            ExtensibilityElement operElem = (ExtensibilityElement) operElems.elementAt(0);
            if (operElem != null && operElem instanceof SOAPOperation) {
                OperationInfo operationInfo = new OperationInfo(style);
                buildOperation(operationInfo, oper);
                operationInfos.add(operationInfo);
            } else if (operElem != null && operElem instanceof SOAP12Operation) {
                OperationInfo operationInfo = new OperationInfo(style);
                buildOperation(operationInfo, oper);
                operationInfos.add(operationInfo);
            }
        }
    }
    return operationInfos;
}
Also used : OperationInfo(org.talend.designer.webservice.ws.wsdlinfo.OperationInfo) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) BindingOperation(javax.wsdl.BindingOperation) SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) SOAP12Operation(javax.wsdl.extensions.soap12.SOAP12Operation) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) List(java.util.List) ArrayList(java.util.ArrayList) Vector(java.util.Vector) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 10 with BindingOperation

use of javax.wsdl.BindingOperation in project tomee by apache.

the class JaxRpcServiceInfoBuilder method getStyle.

private BindingStyle getStyle(Binding binding) throws OpenEJBException {
    SOAPBinding soapBinding = getExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements());
    String styleString = soapBinding.getStyle();
    BindingInput bindingInput = ((BindingOperation) binding.getBindingOperations().get(0)).getBindingInput();
    SOAPBody soapBody = getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements());
    String useString = soapBody.getUse();
    BindingStyle bindingStyle = BindingStyle.getBindingStyle(styleString, useString);
    return bindingStyle;
}
Also used : BindingOperation(javax.wsdl.BindingOperation) SOAPBody(javax.wsdl.extensions.soap.SOAPBody) SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) BindingInput(javax.wsdl.BindingInput)

Aggregations

BindingOperation (javax.wsdl.BindingOperation)11 Binding (javax.wsdl.Binding)5 Port (javax.wsdl.Port)5 Collection (java.util.Collection)4 Input (javax.wsdl.Input)4 Message (javax.wsdl.Message)4 Operation (javax.wsdl.Operation)4 Output (javax.wsdl.Output)4 Service (javax.wsdl.Service)4 HashSet (java.util.HashSet)3 List (java.util.List)3 BindingInput (javax.wsdl.BindingInput)3 Fault (javax.wsdl.Fault)3 SOAPBinding (javax.wsdl.extensions.soap.SOAPBinding)3 SOAPOperation (javax.wsdl.extensions.soap.SOAPOperation)3 SOAP12Operation (javax.wsdl.extensions.soap12.SOAP12Operation)3 QName (javax.xml.namespace.QName)3 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 Vector (java.util.Vector)2