return prevState;
}
private void validatePayload(Source source)
{
SchemaExtractor schemaExtractor = new SchemaExtractor();
try
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
feature = epMetaData.getFeature(SchemaValidationFeature.class);
URL xsdURL = feature.getSchemaLocation() != null ? new URL(feature.getSchemaLocation()) : null;
if (xsdURL == null)
{
URL wsdlURL = epMetaData.getServiceMetaData().getWsdlFileOrLocation();
if (wsdlURL == null)
{
log.warn("Validation error: Cannot obtain wsdl URL");
}
else
{
xsdURL = schemaExtractor.getSchemaUrl(wsdlURL);
}
}
if (xsdURL != null)
{
ErrorHandler errorHandler = feature.getErrorHandler();
Element xmlDOM = DOMUtils.sourceToElement(source);
new SchemaValidationHelper(xsdURL).setErrorHandler(errorHandler).validateDocument(xmlDOM);
}
}
catch (RuntimeException rte)
{
throw rte;
}
catch (Exception ex)
{
WSException.rethrow(ex);
}
finally
{
schemaExtractor.close();
}
}