Code:
<createDataTypesResponse xmlns="http://springws.cas.de" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<casDataTypes xsi:type="AddressDataType" >
<key>123</key>
<FirstName>Fritz</FirstName>
<LastName>Meier</LastName>
</casDataTypes>
</createDataTypesResponse>
JAXB 1.6 doesn't handle that it right, it never produces the xsi:type attribute which i need.
I switched back to JAXB 2.0 and it's working nearly fine. I got the following soap response:
Code:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header />
<SOAP-ENV:Body>
<ns2:createDataTypesResponse xmlns:ns2="http://springws.cas.de">
<ns2:casDataType
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns2:AddressDataType">
<ns2:key>123</ns2:key>
<ns2:firstName>Fritz</ns2:firstName>
<ns2:lastName>Meier</ns2:lastName>
</ns2:casDataType>
</ns2:createDataTypesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The Problem is, that i get an validation error in my log file. Any idea why?
Code:
DEBUG webservice.CreateDataTypesRequestEndpoint - Unmarshalled payload request to [javax.xml.bind.JAXBElement@13ed2e3]
DEBUG webservice.CreateDataTypesRequestEndpoint - Marshalling [javax.xml.bind.JAXBElement@1873ad9] to response payload
ERROR endpoint.PayloadValidatingInterceptor - XML validation error on response: UndeclaredPrefix: Cannot resolve 'ns2:AddressDataType' as a QName: the prefix 'ns2' is not declared.
ERROR endpoint.PayloadValidatingInterceptor - XML validation error on response: cvc-elt.4.1: The value 'ns2:AddressDataType' of attribute 'http://www.w3.org/2001/XMLSchema-instance,type' of element 'ns2:casDataType' is not a valid QName.
ERROR endpoint.PayloadValidatingInterceptor - XML validation error on response: UndeclaredPrefix: Cannot resolve 'ns2:AddressDataType' as a QName: the prefix 'ns2' is not declared.
ERROR endpoint.PayloadValidatingInterceptor - XML validation error on response: cvc-attribute.3: The value 'ns2:AddressDataType' of attribute 'xsi:type' on element 'ns2:casDataType' is not valid with respect to its type, 'QName'.
ERROR endpoint.PayloadValidatingInterceptor - XML validation error on response: cvc-complex-type.2.4.d: Invalid content was found starting with element 'ns2:firstName'. No child element is expected at this point.
Cheers,
Ingo