Note that there are some explanatory texts on larger screens.

plurals
  1. POCXF - JAX-WS server side Schema Validation does not find element definition
    text
    copied!<p>I have a web service that defines severals schemas in the <code>webTypes</code> section. I define a <code>read</code> operation which type is define in this schema:</p> <pre><code>&lt;xs:schema version="1.0" targetNamespace="http://example.com/webservice/service" xmlns:ns0="http://example.com/webservice/parameter" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:import namespace="http://example.com/webservice/parameter"/&gt; &lt;xs:complexType name="read"&gt; &lt;xs:sequence&gt; &lt;xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" /&gt; &lt;xs:element name="filter" type="ns0:filter" minOccurs="0" maxOccurs="1"/&gt; &lt;xs:element name="startIndex" type="xs:int" minOccurs="1" maxOccurs="1" /&gt; &lt;xs:element name="noOfResults" type="xs:int" minOccurs="1" maxOccurs="1" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:element name="read" type="tns:read"/&gt; &lt;/xs:schema&gt; </code></pre> <p>Then I activate the schema validation in the CXF config file like this:</p> <pre><code>&lt;jaxws:endpoint id="dataService" implementor="com.example.webservice.jaxws.endpoint.SIB" address="/DataService" wsdlLocation="classpath:DataService.wsdl"&gt; &lt;jaxws:properties&gt; &lt;entry key="schema-validation-enabled" value="true" /&gt; &lt;/jaxws:properties&gt; &lt;/jaxws:endpoint&gt; </code></pre> <p>I tested my schema validating some of my request with the SOAPUI validator, and it works perfectly. But in the server side, when a request is received I'm getting this error:</p> <pre><code>Caused by: javax.xml.bind.UnmarshalException - with linked exception: [org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'name'.] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:425) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339) at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:768) ... 287 more Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'name'. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.startElement(Unknown Source) at com.sun.xml.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:96) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:242) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:176) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360) ... 289 more </code></pre> <p>Any Clue? It seems that the validator can access the "read" operation definition. I don't know what to do because actually the webservices works correctly without the schema validation, but I want to avoid param validation in the web services implementation.</p> <p>Thanks in advance,</p> <p><strong>NOTE</strong> I'm Using CXF 2.3.3 with JAXWS 2.2 and JAXB 2.2.1 in a non endorsed tomcat 6 with java 1.6.0.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload