History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-855
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Tomasz Sztelak
Reporter: Frank Grupe
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
XFire

Schema validation in JAXB does not return validation errors to the client #2

Created: 23/Jan/07 08:19 AM   Updated: 17/Feb/08 04:53 PM
Component/s: JAXB 2.0
Affects Version/s: 1.2.4
Fix Version/s: 1.2.5

Time Tracking:
Not Specified

File Attachments: 1. XML File services.xml (0.7 kb)
2. Java Source File TestWebService.java (0.4 kb)
3. XML File TestWebService.xsd (0.4 kb)



 Description  « Hide
Hi,

this Issue should be a reopen for XFIRE-771. Perhaps there has happend a mistake when checking in the fix for that one?
Because I get the same problem as described there in version 1.2.4:
Instead of information about the nested validation Exception there appears only the "Unmarshal" Exception at the client side when a validation error occurs:
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Could not unmarshall type.</faultstring>
</soap:Fault>

I'd also prefer to see something like this instead, so that the caller can react himself:
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'width'. One of '{"":length}' is expected.</faultstring>
</soap:Fault>

Could you please check what went wrong?

Thanks,
Frank



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Tomasz Sztelak - 20/Feb/07 10:30 AM
Can you provide simple test ( with schema') or junit to reproduce this problem ?

Frank Grupe - 28/Feb/07 03:19 AM
Hi Tomasz,

I don't have an XFire build environment, just working with the binaries, so I have attached a simple testcase containing the XSD for JAXB generation, the services.xml with the validation enabled and a simple WebService implementation.
I have tested the WebService with the Eclipse build-in WebService Explorer and when I pass an invalid SOAP Message e.g. with a missing parameter like:

<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://www.test.de" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<q0:Test />
</soapenv:Body>
</soapenv:Envelope>

The service returns a fault missing the actual validation Exeption:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Could not unmarshall type.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>

Whereas I would expect something like this, which I only see in the server log. But the client side should see this detailed fault message to be able to correct it I think:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Could not unmarshall type.: org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of element 'q0:Test' is not complete. One of '{"":teststring}' is expected.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>


Tomasz Sztelak - 01/Mar/07 02:52 AM
Fixed in svn

Paul King - 17/Feb/08 04:53 PM
I know this is a little old, but just wondering why faultcode here is soap:Server not soap:Client. Surely, if the incoming request is not valid, it is an error the client has made?