On Oct 31, 2012, at 5:58 AM, John Baker <[email protected]> wrote:
> I've put a debugger on SoapHeaderInterceptor and I can see: > > schema.newValidator().validate(ds); > > being called. I'm beginning to think the problem lies in the Xerces schema > validator? I believe the validation of the headers only occurs for headers that are explicitly declared as headers in the wsdl and are mapped to parameters on the method. Is that the case for your header? Dan > -----Original Message----- > From: John Baker [mailto:[email protected]] > Sent: 30 October 2012 16:34 > To: [email protected] > Subject: Schema validation of SOAP headers > > Hello, > > I note this topic has been discussed before and I have discovered a JIRA > issue (https://issues.apache.org/jira/browse/CXF-4334). However, after > upgrading to CXF 2.6.3, I note the SOAP headers are not being fully validated. > > Consider this schema extract: > > <xs:simpleType name="MessageTypeIDType"> > <xs:restriction base="xs:string"> > <xs:minLength value="1" /> > <xs:pattern value="[0-9a-zA-Z]+" /> > </xs:restriction> > </xs:simpleType> > > <xs:complexType name="RequestHeaderType"> > <xs:sequence> > <xs:element name="MessageTypeID" type="infra:MessageTypeIDType"> > <xs:annotation> > <xs:documentation> docs </xs:documentation> > </xs:annotation> > </xs:element> > </xs:sequence> > </xs:complexType> > > And this extract from the WSDL: > > <wsdl:message name="DIRequestMessage"> > <wsdl:part name="requestHeader" > element="RequestHeaderType " /> > ... > </wsdl:message> > <wsdl:portType name="DIPortType_v1_0"> > <wsdl:operation name="di"> > <wsdl:input > message="tns:DIRequestMessage" /> > ... > <wsdl:fault name="fault" > message="tns:Fault" /> > </wsdl:operation> > </wsdl:portType> > > (I've had to copy, paste and remove some context but I hope it demonstrates > what we've implemented.) > > And finally, this jaxws:endpoint: > > <jaxws:endpoint > implementor="com.x.MyServiceImpl" > address=".."> > <jaxws:features> > <bean class="org.apache.cxf.feature.LoggingFeature"/> > </jaxws:features> > <jaxws:properties> > <entry key="schema-validation-enabled" value="true" /> </jaxws:properties> > </jaxws:endpoint> > > When I connect to it via SOAP UI, I note CXF correctly validates the > existence of the MessageTypeID element but not the value to ensure it meets > the restriction. > > Any input most welcome. > > Thanks > > > John > > > > <FONT size=1> <P><FONT > size=2>****************************************************************************************</FONT></P><P><FONT > size=2>The information contained in this email may be confidential. It is > intended</FONT></P><P><FONT size=2>only for the use of the named recipient. > If you are not the named recipient</FONT></P><P><FONT size=2>please delete > this email and notify the sender of the delivery error. If > you</FONT></P><P><FONT size=2>have received this email and are not the named > recipient, any disclosure,</FONT></P><P><FONT size=2>reproduction, > distribution or other dissemination or use of the > information</FONT></P><P><FONT size=2>contained in this email is strictly > prohibited.</FONT></P><P><FONT size=2> </FONT></P><P><FONT size=2>The > transmission of email cannot be guaranteed to be secure or error free > as</FONT></P><P><FONT size=2>information could be intercepted, corrupted, > lost, destroyed, arrive late or</FONT></P><P><FONT size=2>incomplete, or > contain viruses. The sender therefore does not accept</FONT></P><P><FONT > size=2>liability for any errors or omissions in the contents of this message > which</FONT></P><P><FONT size=2>arise as a result of email transmission. If > verification is required please</FONT></P><P><FONT size=2>request a hard copy > version.</FONT></P><P><FONT size=2> </FONT></P><P><FONT size=2>The Camelot > group of companies includes:</FONT></P><P><FONT size=2>Camelot UK Lotteries > Limited (reg. no 2822203), Camelot Business Solutions</FONT></P><P><FONT > size=2>Limited (reg. no 07553982), Camelot Strategic Solutions Limited (reg. > no</FONT></P><P><FONT size=2>07553980), Camelot Global Services Limited (reg. > no 02822300) and Camelot</FONT></P><P><FONT size=2>Commercial Services > Limited (reg. no 06911097), all of which are registered</FONT></P><P><FONT > size=2>in England and Wales and have their registered office > at:</FONT></P><P><FONT size=2>Tolpits Lane</FONT></P><P><FONT > size=2>Watford</FONT></P><P><FONT size=2>WD18 9RN</FONT></P><P><FONT > size=2>Tel : 01923 425000</FONT></P><P><FONT > size=2>***************************************************************************************</FONT></P></FONT> -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
