PDA

View Full Version : more than one schema in PayloadValidatingInterceptor


res1st
Jul 7th, 2006, 11:08 AM
Hi,

i have more than one schema which PayloadValidatingInterceptor should use.
The JAXB marshaller have an schemas element, something similar would be nice for the PayloadValidatingInterceptor.

Cheers,

Ingo

Arjen Poutsma
Jul 7th, 2006, 12:33 PM
You're right. Could you create an issue? Thanks!

marknoten
Aug 1st, 2007, 05:41 PM
Arjen,

I'm using the schemas property on the PayloadValidationInterceptor but it only validates payload request correctly for the first XSD schema location defined in the list.

<property name="interceptors">
<list>
<bean
class="org.springframework.ws.soap.server.endpoint.interc eptor.PayloadValidatingInterceptor">
<property name="schemas">
<list>
<value>
/WEB-INF/xsd/PaymentSubmission.xsd
</value>
<value>
/WEB-INF/xsd/Notifications.xsd
</value>
</list>
</property>
<property name="validateRequest" value="true" />
<property name="validateResponse" value="true" />
</bean>
</list>
</property>

If I switch the order than the FileSubmission Web Services works well and visa versa. Could it be that it's because the two XSD schemas share the same target namespace?

I looked a bit in the source code but I could not locate why I'm having this strange behavior. A solution could be to just put them together in one XSD shema. Sadly I didn't make the WSDL definitions where I extracted these XSD schemas from.

Kind regards,

Mark

Arjen Poutsma
Aug 2nd, 2007, 06:39 AM
Which version of the JDK are you using?

marknoten
Aug 4th, 2007, 05:40 AM
I'm using JDK 1.5

For now, I put both schema definition elements that share the same namespace together in one XSD file. I used the schema property instead of the schemas property and that works ofcourse.

Mark

denov
Aug 24th, 2007, 12:37 AM
You're right. Could you create an issue? Thanks!
has there been a ticket opened for this? what's the status?

exgorth
Aug 24th, 2007, 05:46 AM
really, please tell what is the status of this problem?

Arjen Poutsma
Aug 24th, 2007, 10:26 AM
There is no JIRA issue yet, as far as I know.

exgorth
Aug 24th, 2007, 10:28 AM
should we create one (or two)?

Arjen Poutsma
Aug 24th, 2007, 10:30 AM
Please create an issue here: http://opensource.atlassian.com/projects/spring/browse/SWS. Make sure to attach the multiple schema files which show the problem, if possible.

denov
Aug 24th, 2007, 02:04 PM
Please create an issue here: http://opensource.atlassian.com/projects/spring/browse/SWS. Make sure to attach the multiple schema files which show the problem, if possible.
done! http://opensource.atlassian.com/projects/spring/browse/SWS-176

hopefully somebody can quickly fix it.

denov
Oct 3rd, 2007, 09:26 PM
Arjen,

If I switch the order than the FileSubmission Web Services works well and visa versa. Could it be that it's because the two XSD schemas share the same target namespace?



Yes! this is the problem. After Arjen created a unit test i noticed that he had separate namespaces for each of this xsd files. So i changed the namespaces on my xsd and everything worked.

Yuriy.
Dec 5th, 2007, 05:40 AM
The problem still exists in Spring-WS 1.0.2.

robertoschwald
Dec 6th, 2007, 02:45 AM
The namespace collition problem was also the point we hit as we built a second webservice.
Therefore, we set a unique target namespace for every webservice we deploy.

As long as the two webservices got no relation to each other, this isn't a problem.
But if you have to deploy another version of an existing webservice in parallel to the old one (e.g to not break other apps that use your service), this is not optimal.

Btw: The PayloadValidationInterceptor seems to accept schema file wildcards also:
<bean class="org.springframework.ws.soap.server.endpoint.interc eptor.PayloadValidatingInterceptor">
<property name="schemas">
<list>
<value>/WEB-INF/ws/*.xsd</value>
</list>
</property>
<property name="validateRequest" value="true"/>
<property name="validateResponse" value="true"/>
</bean>

Yuriy.
Dec 6th, 2007, 07:18 AM
We can not set a unique target namespace for every webservice, so we need a solution for that problem. Do anybody know how to use PayloadValidatingInterceptor with a set of schemas that share the same namespace?

Arjen Poutsma
Dec 7th, 2007, 09:13 AM
The schema handling code Spring-WS's PayloadValidatingInterceptor depends on javax.xml.validation.Schema. The algorithm for multiple namespaces is described here: http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/SchemaFactory.html#newSchema(javax.xml.transform.S ource[]), the "W3C XML Schema 1.0" part of that method specifically.

jimcummings
Mar 26th, 2008, 03:51 PM
I ran into this problem too when using the PayloadValidatingInterceptor to validate against multiple schemas that were all in the same namespace. Due to what looks to be a vagueness in the spec or the JAXP implementation, there is some flakiness when validating multiple schemas with the same namespace.

For what it is worth, I was able to get past my problems by pointing my validating interceptor to a single xsd file that included all my schemas, and by avoiding using relative paths that used "../". This works fine now. I think the weirdness is in JAXP, not spring-ws.

BTW - Afterwards I found this link where someone else encountered basically the exact same problems I did. See: http://kontrawize.blogs.com/kontrawize/2007/10/the-trouble-wit.htm

jimcummings
Mar 26th, 2008, 03:54 PM
I ran into this problem too when using the PayloadValidatingInterceptor to validate against multiple schemas that were all in the same namespace. Due to what looks to be a vagueness in the spec or the JAXP implementation, there is some flakiness when validating multiple schemas with the same namespace.

For what it is worth, I was able to get past my problems by pointing my validating interceptor to a single xsd file that included all my schemas, and by avoiding using relative paths that used "../". This works fine now. I think the weirdness is in JAXP, not spring-ws.

BTW - Afterwards I found this link where someone else encountered basically the exact same problems I did. See: http://kontrawize.blogs.com/kontrawize/2007/10/the-trouble-wit.htm
Fixing the link in my post: http://kontrawize.blogs.com/kontrawize/2007/10/the-trouble-wit.html