users@jaxb.java.net

Unmarshalling with namespace xsd-validation

From: javamustang <max.laenzlinger_at_gmx.ch>
Date: Mon, 6 Jul 2009 05:11:37 -0700 (PDT)

Hello all,
I made a REST Service with CXF, because it can validate incoming xml against
a xsd. Problem is, Validation works fine, but the setters of the complex
incoming type are not called. (without validation the unmarshalling works)
Many thanks for all ideas.

-----------------------
SERVICE:
...
@POST
@Produces("application/xml")
@Consumes("application/xml")
public TestResponse test (TestRequest testRequest)
...

-----------------------
TestRequest.java:

@XmlRootElement (name="serviceRequest", namespace =
"http://www.example.org/books" )

public class TestRequest
{
private String testdata;
...
}

-----------------------
DATA:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<b:serviceRequest xmlns:b="http://www.example.org/books">
   <b:testdata>hello</b:testdata>
</b:serviceRequest>

-----------------------
XSD:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://www.example.org/books"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
        <xs:element name="serviceRequest" >
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="testdata">
                                        <xs:simpleType>
                                                <xs:restriction base="xs:string">
                                                        <xs:length value="5"/>
                                                </xs:restriction>
                                        </xs:simpleType>
                                </xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>
-- 
View this message in context: http://www.nabble.com/Unmarshalling-with-namespace-xsd-validation-tp24354306p24354306.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.