Answered in the FAQ:

http://cxf.apache.org/faq.html#FAQ-HowcanIturnonschemavalidationforjaxwsendpoint%3F

Dan



On Jun 19, 2013, at 12:20 PM, Hilderich <[email protected]> wrote:

> Hello All!
> 
> we are using Apache CXF together with Apache Camel inside Apache Karaf:
> 
> - Apache CXF Compatibility Bundle Jar (2.6.3)
> - camel-cxf (2.10.2)
> 
> We are using a web service via code first apprach.
> 
> The issue we are encounter is that an missing parameter inside the
> /complexType /
> (XML Schema) is ignored by the validation although the /complexType /is
> configured
> as follows (WSDL snippet):
> ...
> <xs:complexType name="orderDataMergingBean">
>   <xs:sequence>
>            <xs:element name="brandNo" type="xs:string"/>
>            <xs:element name="brandName" type="xs:string"/>
>            <xs:element name="packageType" type="xs:string"/>
>            <xs:element name="packageFormat" type="xs:string"/>
>            <xs:element name="inputDir" type="xs:string"/>
>            <xs:element minOccurs="0" name="acceptanceTimestamp"
> type="xs:dateTime"/>
>           <xs:element minOccurs="0" name="orderSource" type="xs:string"/>
>           <xs:element name="override" type="xs:boolean"/>
>    </xs:sequence>
> </xs:complexType>
> ...
> 
> When we omit e.g. the /packageType /information for the request the web
> service can be
> used still though /packageTyp /is equipped implicit with minOccurs=1 and
> maxOccurs=1.
> 
> How can we configure the web service properly to refuse such a request and
> tell the client
> that such a request is invalid?
> 
> The Java class (code first approach) looks as below:
> 
> @XmlRootElement(name = "order")
> @XmlAccessorType(XmlAccessType.FIELD)
> public class OrderDataMergingBean implements Serializable {
> 
>       ...
>       @XmlElement(required=true)
>       private TecdocType packageType; 
> ...
> 
> Many thanks in advanced
> Hilderich
> 
> 
> 
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/elements-with-minOccurs-1-in-a-complexType-not-honoured-tp5729512.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to