@Override
public void onCougarStart() {
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
for (ServiceBindingDescriptor sd : getServiceBindingDescriptors()) {
SoapServiceBindingDescriptor soapServiceDesc = (SoapServiceBindingDescriptor) sd;
try {
// we'll load the schema content and create a Schema object once, as this is threadsafe and so can be reused
// this should cut down on some memory usage and remove schema parsing from the critical path when validating
try (InputStream is = soapServiceDesc.getClass().getClassLoader().getResourceAsStream(soapServiceDesc.getSchemaPath())) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StreamUtils.copy(is, baos);
String schemaContent = baos.toString();
Schema schema = schemaFactory.newSchema(new StreamSource(new StringReader(schemaContent)));
String uriVersionStripped = stripMinorVersionFromUri(soapServiceDesc.getServiceContextPath() + soapServiceDesc.getServiceVersion());
for (OperationBindingDescriptor desc : soapServiceDesc.getOperationBindings()) {
SoapOperationBindingDescriptor soapOpDesc = (SoapOperationBindingDescriptor) desc;
OperationDefinition opDef = getOperationDefinition(soapOpDesc.getOperationKey());
String operationName = uriVersionStripped + "/" + soapOpDesc.getRequestName().toLowerCase();
bindings.put(operationName,
new SoapOperationBinding(opDef, soapOpDesc,