public void process()

in core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL1Processor.java [57:109]


    public void process(InternalEndpoint serviceEndpoint) {
        try {
            Document document = registry.getEndpointDescriptor(serviceEndpoint);
            if (document == null || document.getDocumentElement() == null) {
                LOGGER.debug("Endpoint {} has no service description", serviceEndpoint);
                return;
            }
            if (!WSDL1_NAMESPACE.equals(document.getDocumentElement().getNamespaceURI())) {
                LOGGER.debug("Endpoint {} has a non WSDL1 service description", serviceEndpoint);
                return;
            }
            WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
            reader.setFeature(Constants.FEATURE_VERBOSE, false);
            Definition definition = reader.readWSDL(null, document);
            // Check if the wsdl is only a port type
            // In these cases, only the port type is used, as the service name and endpoint name
            // are provided on the jbi endpoint
            if (definition.getPortTypes().keySet().size() == 1
                    && definition.getServices().keySet().size() == 0) {
                PortType portType = (PortType) definition.getPortTypes().values().iterator().next();
                QName interfaceName = portType.getQName();
                LOGGER.debug("Endpoint {} implements interface {}", serviceEndpoint, interfaceName);
                serviceEndpoint.addInterface(interfaceName);
            } else {
                Service service = definition.getService(serviceEndpoint.getServiceName());
                if (service == null) {
                    LOGGER.info("Endpoint {} has a service description, but no matching service found in {}",
                            serviceEndpoint, definition.getServices().keySet());
                    return;
                }
                Port port = service.getPort(serviceEndpoint.getEndpointName());
                if (port == null) {
                    LOGGER.info("Endpoint {} has a service description, but no matching endpoint found in {}",
                            serviceEndpoint, service.getPorts().keySet());
                    return;
                }
                if (port.getBinding() == null) {
                    LOGGER.info("Endpoint {} has a service description, but no binding found", serviceEndpoint);
                    return;
                }
                if (port.getBinding().getPortType() == null) {
                    LOGGER.info("Endpoint {} has a service description, but no port type found", serviceEndpoint);
                    return;
                }
                QName interfaceName = port.getBinding().getPortType().getQName();
                LOGGER.debug("Endpoint {} implements interface {}", serviceEndpoint, interfaceName);
                serviceEndpoint.addInterface(interfaceName);
            }
        } catch (Exception e) {
            LOGGER.warn("Error retrieving interfaces from service description: {}", e.getMessage());
            LOGGER.debug("Error retrieving interfaces from service description", e);
        }
    }