[ https://issues.apache.org/jira/browse/CXF-5169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13833363#comment-13833363 ]
Xilai Dai edited comment on CXF-5169 at 11/27/13 2:22 AM: ---------------------------------------------------------- Thanks Dan! Yes, the exception gone with this change: {code} respEle.addElement("out", "").addText("Echo: " + in.getText()); {code} but now the schema validation ONLY takes effect on Response (OUT) message, it will do nothing validation on the Request (IN) message. For example, with this request: {code} <ser:DemoServiceOperationRequest> <in>123</in> </ser:DemoServiceOperationRequest> {code} what expected is fault with unsatisfied request but actually the fault info is about invalid response. {code} <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Could not generate the XML stream caused by: org.xml.sax.SAXParseException: cvc-minLength-valid: Value 'Echo: 123' with length = '9' is not facet-valid with respect to minLength '20' for type '#AnonType_outDemoServiceOperationResponse'..</faultstring> </soap:Fault> {code} As I remember, it works well with request validation before fix. was (Author: xldai): Thanks Dan! Yes, the exception gone with this change: {code} respEle.addElement("out", "").addText("Echo: " + in.getText()); {code} but now the schema validation ONLY takes effect on Response (OUT) message, it will do nothing validation on the Request (IN) message. For example, with this request: {code} <ser:DemoServiceOperationRequest> <in>123</in> </ser:DemoServiceOperationRequest> {code} what expected is fault with unsatisfied request but actually the fault info is about invalid response. {code} <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Could not generate the XML stream caused by: org.xml.sax.SAXParseException: cvc-minLength-valid: Value 'Echo: 123' with length = '9' is not facet-valid with respect to minLength '20' for type '#AnonType_outDemoServiceOperationResponse'..</faultstring> </soap:Fault> {code} > the schema-validation-enabled property doesn't work for OUT message validation > ------------------------------------------------------------------------------ > > Key: CXF-5169 > URL: https://issues.apache.org/jira/browse/CXF-5169 > Project: CXF > Issue Type: Improvement > Components: Core > Affects Versions: 2.7.6 > Reporter: Xilai Dai > Assignee: Freeman Fang > Fix For: 2.6.10, 2.7.7, 3.0.0-milestone2 > > Attachments: test_validation_service.zip > > > With this configuration: > {code} > <jaxws:endpoint ...> > ...... > <jaxws:properties> > <entry key="schema-validation-enabled" value="true" /> > </jaxws:properties> > </jaxws:endpoint> > {code} > then, the schema validation for Request(IN) message works well, but it > doesn't take any effect for Response(OUT) message. > the schema (from WSDL) piece example which I used is: > {code} > <xsd:element name="DemoServiceOperationResponse"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="out"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:minLength value="20"></xsd:minLength> > <xsd:maxLength value="30"></xsd:maxLength> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > {code} -- This message was sent by Atlassian JIRA (v6.1#6144)