Hi

Have a look please if a warning is being displayed about a schema resource not found when the server starts

Cheers, Sergey
On 02/12/14 16:51, nikosdim wrote:
Hi

I have written a JAXRS service with accepts xml as input in the body of a
POST request. The xml is converted to an JAXB Object automatically. Below is
my code and configuration

Using CXF 3.0.1, tomcat 7.0.42, java 1.7.0_55

*Service*
@Path("incident")
public class CreateIncident {
        @POST
        @Consumes({ MediaType.APPLICATION_XML})
        public Response createIncident(Incident incident) {
                        //code
        }
}

*JAXB Object*
@XmlRootElement(name = "incident")
@XmlAccessorType(XmlAccessType.FIELD)
public class Incident extends Event {
        public Incident() {
                super("incident");
        }
        
        private String importProfile;
        
        public String getImportProfile() {
                return importProfile;
        }

        public void setImportProfile(String importProfile) {
                this.importProfile = importProfile;
        }
}

*Config*
<jaxrs:server address="/">
                <jaxrs:schemaLocations>
                        
<jaxrs:schemaLocation>classpath:xsd/incident.xsd</jaxrs:schemaLocation>
                </jaxrs:schemaLocations>
                <jaxrs:serviceBeans>
                        <bean 
class="com.ba.sysman.services.events.CreateIncident"></bean>
                </jaxrs:serviceBeans>
                <jaxrs:features>
                        <cxf:logging/>
                </jaxrs:features>
</jaxrs:server>

When I am sending a POST request to the service with an xml that does not
conform with the xsd defined in the jaxrs:schemaLocation tag the Incident
object is populated with no xsd errors or exceptions.

What is wrong with my configuration?

Thanks



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Validate-JAXB-Object-with-xsd-schema-tp5751783.html
Sent from the cxf-user mailing list archive at Nabble.com.


Reply via email to