We're using Apache CXF with Dropwizard-JAXWS to interact with a SOAP service. We want to validate responses on the client level.
We've tried this:
((BindingProvider)port).getRequestContext().put("schema-validation-enabled", "true");
from http://cxf.apache.org/faq.html when constructing the client, with no luck.
The closest we've gotten is writing an interceptor for the client and adding the following to the message
public class ClientResponseSchemaValidatingInterceptor extends AbstractSoapInterceptor {
public ClientResponseSchemaValidatingInterceptor() {
super(Phase.RECEIVE);
}
@Override
public void handleMessage(SoapMessage message) {
message.put(Message.SCHEMA_VALIDATION_ENABLED, validationEnabled);
message.getExchange().getInMessage().put(Message.SCHEMA_VALIDATION_ENABLED, validationEnabled);
message.getExchange().put(Message.SCHEMA_VALIDATION_ENABLED, validationEnabled);
}
}
which seems to validate mandatory attributes being present or not but not the contents (i.e. matching a regex in the xsd)