Search in sources :

Example 66 with Binding

use of javax.wsdl.Binding in project cxf by apache.

the class WSDLDefinitionBuilderTest method testBuildImportedWSDL.

@Test
public void testBuildImportedWSDL() throws Exception {
    String wsdlUrl = getClass().getResource("hello_world_services.wsdl").toString();
    WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(BusFactory.getDefaultBus());
    Definition def = builder.build(wsdlUrl);
    assertNotNull(def);
    Map<?, ?> services = def.getServices();
    assertNotNull(services);
    assertEquals(1, services.size());
    String serviceQName = "http://apache.org/hello_world/services";
    Service service = (Service) services.get(new QName(serviceQName, "SOAPService"));
    assertNotNull(service);
    Map<?, ?> ports = service.getPorts();
    assertNotNull(ports);
    assertEquals(1, ports.size());
    Port port = service.getPort("SoapPort");
    assertNotNull(port);
    Binding binding = port.getBinding();
    assertNotNull(binding);
    QName bindingQName = new QName("http://apache.org/hello_world/bindings", "SOAPBinding");
    assertEquals(bindingQName, binding.getQName());
    PortType portType = binding.getPortType();
    assertNotNull(portType);
    QName portTypeQName = new QName("http://apache.org/hello_world", "Greeter");
    assertEquals(portTypeQName, portType.getQName());
    Operation op1 = portType.getOperation("sayHi", "sayHiRequest", "sayHiResponse");
    assertNotNull(op1);
    QName messageQName = new QName("http://apache.org/hello_world/messages", "sayHiRequest");
    assertEquals(messageQName, op1.getInput().getMessage().getQName());
    Part part = op1.getInput().getMessage().getPart("in");
    assertNotNull(part);
    assertEquals(new QName("http://apache.org/hello_world/types", "sayHi"), part.getElementName());
}
Also used : Binding(javax.wsdl.Binding) QName(javax.xml.namespace.QName) Part(javax.wsdl.Part) Port(javax.wsdl.Port) Definition(javax.wsdl.Definition) Service(javax.wsdl.Service) Operation(javax.wsdl.Operation) PortType(javax.wsdl.PortType) Test(org.junit.Test)

Example 67 with Binding

use of javax.wsdl.Binding 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);
            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 68 with Binding

use of javax.wsdl.Binding 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 69 with Binding

use of javax.wsdl.Binding in project pentaho-kettle by pentaho.

the class Wsdl method getOperation.

/**
 * Find the specified operation in the WSDL definition.
 *
 * @param operationName
 *          Name of operation to find.
 * @return A WsdlOperation instance, null if operation can not be found in WSDL.
 */
public WsdlOperation getOperation(String operationName) throws KettleStepException {
    // is the operation in the cache?
    if (_operationCache.containsKey(operationName)) {
        return _operationCache.get(operationName);
    }
    Binding b = _port.getBinding();
    PortType pt = b.getPortType();
    Operation op = pt.getOperation(operationName, null, null);
    if (op != null) {
        try {
            WsdlOperation wop = new WsdlOperation(b, op, _wsdlTypes);
            // cache the operation
            _operationCache.put(operationName, wop);
            return wop;
        } catch (KettleException kse) {
            LogChannel.GENERAL.logError("Could not retrieve WSDL Operator for operation name: " + operationName);
            throw new KettleStepException("Could not retrieve WSDL Operator for operation name: " + operationName, kse);
        }
    }
    return null;
}
Also used : Binding(javax.wsdl.Binding) KettleException(org.pentaho.di.core.exception.KettleException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) Operation(javax.wsdl.Operation) PortType(javax.wsdl.PortType)

Aggregations

Binding (javax.wsdl.Binding)69 QName (javax.xml.namespace.QName)39 BindingOperation (javax.wsdl.BindingOperation)28 SOAPBinding (javax.wsdl.extensions.soap.SOAPBinding)22 Definition (javax.wsdl.Definition)18 SOAP12Binding (javax.wsdl.extensions.soap12.SOAP12Binding)18 Test (org.junit.Test)18 Port (javax.wsdl.Port)17 Operation (javax.wsdl.Operation)16 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)15 PortType (javax.wsdl.PortType)14 Service (javax.wsdl.Service)12 BindingType (org.apache.cxf.binding.corba.wsdl.BindingType)12 ToolException (org.apache.cxf.tools.common.ToolException)12 File (java.io.File)9 ArrayList (java.util.ArrayList)8 BindingInput (javax.wsdl.BindingInput)8 Message (javax.wsdl.Message)8 Map (java.util.Map)7 HashSet (java.util.HashSet)6