public void process()

in core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java [60:113]


    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 (!WSDL2_NAMESPACE.equals(document.getDocumentElement().getNamespaceURI())) {
                LOGGER.debug("Endpoint {} has a non WSDL2 service description", serviceEndpoint);
                return;
            }
            WSDLReader reader = new DOMWSDLReader();
            DOMWSDLSource source = (DOMWSDLSource) reader.createWSDLSource();
            source.setSource(document);
            DescriptionElement descElement = reader.readWSDL(source);
            Description desc = descElement.toComponent();
            // 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 (desc.getInterfaces().length == 1 && desc.getServices().length == 0) {
                Interface itf = desc.getInterfaces()[0];
                QName interfaceName = itf.getName();
                LOGGER.debug("Endpoint {} implements interface {}", serviceEndpoint, interfaceName);
                serviceEndpoint.addInterface(interfaceName);
            } else {
                Service service = desc.getService(serviceEndpoint.getServiceName());
                if (service == null) {
                    LOGGER.info("Endpoint {} has a service description, but no matching service found in {}",
                                    serviceEndpoint, desc.getServices());
                    return;
                }
                Endpoint endpoint = service.getEndpoint(new NCName(serviceEndpoint.getEndpointName()));
                if (endpoint == null) {
                    LOGGER.info("Endpoint {} has a service description, but no matching endpoint found in {}",
                                    serviceEndpoint, service.getEndpoints());
                    return;
                }
                if (endpoint.getBinding() == null) {
                    LOGGER.info("Endpoint {} has a service description, but no binding found", serviceEndpoint);
                    return;
                }
                if (endpoint.getBinding().getInterface() == null) {
                    LOGGER.info("Endpoint {} has a service description, but no port type found", serviceEndpoint);
                    return;
                }
                QName interfaceName = endpoint.getBinding().getInterface().getName();
                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);
        }
    }