Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for custom ErrorHandler in PayloadValidatingInterceptor [SWS-242] #395

Closed
gregturn opened this issue Nov 22, 2007 · 7 comments
Closed

Allow for custom ErrorHandler in PayloadValidatingInterceptor [SWS-242] #395

gregturn opened this issue Nov 22, 2007 · 7 comments

Comments

@gregturn
Copy link
Member

@gregturn gregturn commented Nov 22, 2007

Albert van 't Hart opened SWS-242 and commented

Validating a SOAP request or response with PayloadValidatingInterceptor or Jaxb2Marshaller fails when using MTOM.

The spring-ws MTOM sample fails when PayloadValidatingInterceptor is added to the endpoint interceptor chain.

Schema:
<element name="SendRequest" type="tns:SendMessage"/>

<complexType name="SendMessage">
   	<sequence>
	<element name="sender" type="string"/>
	<element name="recipient" type="string"/>
        	<element name="content" type="base64Binary" xmime:expectedContentTypes="*/*"/>
   	</sequence>

</complexType>

SOAP request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mail="http://www.enovation.nl/ems/mailwebservice">
soapenv:Header/
soapenv:Body
mail:SendRequest
mail:sender1</mail:sender>
mail:recipient2</mail:recipient>
mail:content<inc:Include xmlns:inc="http://www.w3.org/2004/08/xop/include" href="cid:768176637073"/></mail:content>
</mail:SendRequest>
</soapenv:Body>
</soapenv:Envelope>

SOAP response:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
SOAP-ENV:Header/
SOAP-ENV:Body
SOAP-ENV:Fault
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring xml:lang="en">Validation error</faultstring>
<detail>
<spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-type.3.1.2: Element 'mail:content' is a simple type, so it must have no element information item [children].</spring-ws:ValidationError>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Affects: 1.0.2

Referenced from: commits ba2744a

@gregturn
Copy link
Member Author

@gregturn gregturn commented Nov 23, 2007

Arjen Poutsma commented

I don't think this can't be fixed, because the underlying validation mechanism (i.e. javax.xml.validation) is not aware of XOM and MTOM.

Unless a solution is suggested, I will resolve this as won't (or rather: can't) fix.

@gregturn
Copy link
Member Author

@gregturn gregturn commented Nov 23, 2007

Albert van 't Hart commented

I already have looked in the source code for a possible fix and also think this can't be fixed easily.

@gregturn
Copy link
Member Author

@gregturn gregturn commented Nov 23, 2007

Arjen Poutsma commented

Can't fix, unless we find a way to let JAXP deal with XOM.

@gregturn
Copy link
Member Author

@gregturn gregturn commented Jan 7, 2011

Esat Postaci commented

What about the suggested fix on this post.
http://forum.springsource.org/showthread.php?t=71974

Skip elements can be a workaround for this issue.

@gregturn
Copy link
Member Author

@gregturn gregturn commented Jan 7, 2011

Arjen Poutsma commented

Perhaps that will work, I will take a look at it for 2.0.1

@gregturn
Copy link
Member Author

@gregturn gregturn commented Mar 24, 2011

Arjen Poutsma commented

You can now provide your own error handler for the PayloadValidationInterceptor (which should implement org.springframework.xml.validation.ValidationErrorHandler). In that error handler, you can do anything you like (including skipping elements).

I did not provide a way to skip element by default, because it essentially comes down to stack-trace parsing, and I am reluctant to put fragile code like that in the SWS code base.

@gregturn
Copy link
Member Author

@gregturn gregturn commented May 4, 2012

Arjen Poutsma commented

Closing old issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants