-
Apr 22nd, 2009, 07:49 PM
#1
Schema Validation
I have been using Spring Web Services for a couple of months now and I have been using the marshalling end points to serialize the XML message into a bean utilizing JaxB. In one particular instance, I am marshalling the XML message to a bean, only to turn around at the next step and unmarshall it to pass it on to the next guy (i.e. the next process inline operates over XML directly). My question is, if I write my own endpoint, to only grab the XML message from the payload utilizing the MessageEndPoint interface will the message get validated against the WSDL and by extension my XSD? I would like to avoid the extra marshalling/unmarshalling just so I can validate via JaxB, if possible. I hope I have been clear on the issue, any and all help is appreciated.
Last edited by ntchoate; Apr 22nd, 2009 at 07:49 PM.
Reason: misspelling.
-
Apr 23rd, 2009, 07:36 AM
#2
hi,
this depends on the message itself, I think. For instance, if you have messages with little amount of data there's no problem with jaxb, but if in contrary, i think tying to use xpath is better.
-
Apr 23rd, 2009, 08:19 AM
#3
I'm not overly concerned with using JaxB as my marshaller/unmarshaller, I use it in my other web services and it serves me well. I was really looking to know if Spring, outside of the marshaller/unmarshaller, validates the inbound message against the WSDL or my XSD?
-
Apr 23rd, 2009, 08:43 AM
#4
yes, if....
Yes, you can do validation w/o doing jaxb (I think jaxb doesn't even do strict validation unless you tell it to). Use a PayloadValidatingInterceptor. See http://static.springsource.org/sprin...r.html#d0e2977.
HTH,
Greg
-
Apr 26th, 2009, 10:30 AM
#5
Yes, Spring-WS introduces interceptors to validate or log messgage.
steps like this:
In /WEB/spring-ws-servlet.xml (or another Spring-WS specific configuration file according to your servlet name decleared in web.xml)
1) defines a bean definition of SimpleXsdSchema that contains your XSD
2) defines a bean definition of PayloadValidatingInterceptor that validates message contents according to your XSD
3) adds the validating interceptor into the endpoint mapping bean definition
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules