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;
}
Aggregations