CXF's @SchemaValidation annotation not effective on method level

Solution Verified - Updated -

Issue

  • The annotation org.apache.cxf.annotations.SchemaValidation is defined with
    @Target({ ElementType.TYPE, ElementType.METHOD })

However, applying it to single methods of a web service has no effect. More precisely, the following tests lead to unexpected results:

- no annotation on class, annotation on method: the method-level annotation has no effect

- annotation on class, annotation on method (with SchemaValidationType.NONE for overriding the class-level annotation): the method-level annotation has no effect
  • For testing, we used sample project and the following SOAP request that does not conform to the web service's schema because of the "x" attribute:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sam="http://redhat.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <sam:foo x="y"/>
   </soapenv:Body>
</soapenv:Envelope>

Environment

  • Red hat JBoss Enterprise Application Platform (EAP)
    • 6.4.x
  • JBossWS-CXF

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.