Hi 

Here is the update

I registered the provider 
<bean id="jaxbElementProvider"
class="com.ba.sysman.providers.MyJAXBElementProvider"></bean>

and now it goes through validation of the xsd. Without the provider it
doesn't and I have not put any logic in the privider. Just overrided
getSchema(Class<?> cls) and put a breakpoint to see if it is called.
Is this a bug with the spring configuration of cxf ? 


After having registered the provider I send a request to the service with an
xml but I get this

*JAXBException occurred : cvc-elt.1: Cannot find the declaration of element
'incident'.. cvc-elt.1: Cannot find the declaration of element 'incident'..
*



*My xml:*

<incident>
        <eventTitle>Test Title from wrapper</eventTitle>
        <eventDescription>Test description from BAwrapper</eventDescription>
        <affectedUserName>U88sdfs888</affectedUserName>
        <affectedUserTelephone>+440-98772345nj</affectedUserTelephone>
        <reportingUserName>U88888</reportingUserName>
        <eventCategoryName>INCIDENT</eventCategoryName>
        <eventSeriousness>4</eventSeriousness>
        <serviceDepartmentName>NETTECHS</serviceDepartmentName>
        <affectedServiceName>ASSYST</affectedServiceName>
        <affectedAssetName>LXVIRT910</affectedAssetName>
</incident>


*My xsd:*
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
        xmlns="http://www.mydomain.com/schema/Wrapper/incident";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        targetNamespace="http://www.mydomain.com/schema/Wrapper/incident";
        elementFormDefault="qualified">

        <xsd:element name="incident">
                <xsd:complexType>
                        <xsd:sequence>
                                <xsd:element name="eventTitle">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                        <xsd:minLength 
value="1"></xsd:minLength>
                                                        <xsd:maxLength 
value="254"></xsd:maxLength>
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="eventDescription">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                        <xsd:minLength 
value="1"></xsd:minLength>
                                                        <xsd:maxLength 
value="890"></xsd:maxLength>
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="affectedUserName">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                        <xsd:maxLength 
value="254"></xsd:maxLength>
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element
                                        name="affectedUserTelephone"
                                        minOccurs="0">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                        <xsd:maxLength 
value="30"></xsd:maxLength>
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element
                                        name="reportingUserName"
                                        minOccurs="0">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                        <xsd:maxLength 
value="254"></xsd:maxLength>
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="eventCategoryName">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                        <xsd:maxLength 
value="254"></xsd:maxLength>
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="eventSeriousness">
                                        <xsd:simpleType>
                                                <xsd:union memberTypes="empty">
                                                        <xsd:simpleType>
                                                                
<xsd:restriction base="xsd:integer">
                                                                        
<xsd:pattern value="[1|2|3|4]"></xsd:pattern>
                                                                
</xsd:restriction>
                                                        </xsd:simpleType>
                                                </xsd:union>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="serviceDepartmentName">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                        <xsd:maxLength 
value="15"></xsd:maxLength>
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="affectedServiceName">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                        <xsd:maxLength 
value="254"></xsd:maxLength>
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element name="affectedAssetName">
                                        <xsd:simpleType>
                                                <xsd:restriction 
base="xsd:string">
                                                        <xsd:maxLength 
value="254"></xsd:maxLength>
                                                </xsd:restriction>
                                        </xsd:simpleType>
                                </xsd:element>
                                <xsd:element
                                        name="attachments"
                                        minOccurs="0">
                                        <xsd:complexType>
                                                <xsd:sequence maxOccurs="10">
                                                        <xsd:element 
name="attachment">
                                                                
<xsd:complexType>
                                                                        
<xsd:sequence>
                                                                                
<xsd:element
                                                                                
        name="name"
                                                                                
        type="xsd:string"></xsd:element>
                                                                                
<xsd:element
                                                                                
        name="description"
                                                                                
        type="xsd:string"></xsd:element>
                                                                                
<xsd:element
                                                                                
        name="fileName"
                                                                                
        type="xsd:string"></xsd:element>
                                                                                
<xsd:element
                                                                                
        name="fileExtension"
                                                                                
        type="xsd:string"
                                                                                
        default="txt"></xsd:element>
                                                                                
<xsd:element
                                                                                
        name="binary"
                                                                                
        type="xsd:base64Binary"></xsd:element>
                                                                        
</xsd:sequence>
                                                                
</xsd:complexType>
                                                        </xsd:element>
                                                </xsd:sequence>
                                        </xsd:complexType>
                                </xsd:element>
                        </xsd:sequence>
                </xsd:complexType>
        </xsd:element>
        <xsd:simpleType name="empty">
                <xsd:restriction base="xsd:string">
                        <xsd:length value="0"></xsd:length>
                </xsd:restriction>
        </xsd:simpleType>
</xsd:schema>




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

Reply via email to