Search in sources :

Example 1 with IXmlValidator

use of nl.nn.adapterframework.core.IXmlValidator in project iaf by ibissource.

the class WsdlGeneratorUtils method canProvideWSDL.

// Check if the adapter has WebServiceListener with an InputValidator OR
// InputValidator==SoapValidator OR
// IXmlValidator.getSchema()!=NULL && webServiceListenerNamespace!=NULL
public static boolean canProvideWSDL(Adapter adapter) {
    boolean hasWebServiceListener = false;
    String webServiceListenerNamespace = null;
    for (IListener<?> listener : WsdlGeneratorUtils.getListeners(adapter)) {
        if (listener instanceof WebServiceListener) {
            hasWebServiceListener = true;
            webServiceListenerNamespace = ((WebServiceListener) listener).getServiceNamespaceURI();
        }
    }
    IValidator inputValidator = adapter.getPipeLine().getInputValidator();
    if (inputValidator instanceof SoapValidator) {
        // We have to check this first as the SoapValidator cannot use getSchema()
        return true;
    } else if (inputValidator instanceof IXmlValidator) {
        IXmlValidator xmlValidator = (IXmlValidator) inputValidator;
        if (xmlValidator.getSchema() != null) {
            return StringUtils.isNotEmpty(webServiceListenerNamespace);
        }
    }
    // If not an IXmlValidator, return false
    return hasWebServiceListener;
}
Also used : IXmlValidator(nl.nn.adapterframework.core.IXmlValidator) IValidator(nl.nn.adapterframework.core.IValidator) WebServiceListener(nl.nn.adapterframework.http.WebServiceListener)

Aggregations

IValidator (nl.nn.adapterframework.core.IValidator)1 IXmlValidator (nl.nn.adapterframework.core.IXmlValidator)1 WebServiceListener (nl.nn.adapterframework.http.WebServiceListener)1