Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validate SOAP message against WSDL

Just like validating an XML file against an XML Schema Definition in Java is there a way to validate an XML file that contains a SOAP Envelope against a WSDL file?

like image 565
L4zl0w Avatar asked Jul 20 '11 15:07

L4zl0w


2 Answers

Some web service containers provide this functionality. JBoss 3.0.1+ does this with the @SchemaValidation annotation:

http://community.jboss.org/wiki/JBossWS-NativeUserGuide#SchemaValidation

like image 158
Eric Avatar answered Oct 23 '22 04:10

Eric


If you are using Spring-WS, this can be done by using an interceptor along these lines:

<sws:interceptors>
    <sws:payloadRoot namespaceUri="...">
        <bean id="validatingInterceptor"
            class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
            <property name="schema" value="classpath:/wsdl/schema.xsd" />
            <property name="validateRequest" value="true" />
            <property name="validateResponse" value="true" />
        </bean>
    </sws:payloadRoot>
</sws:interceptors>

With CXF, here is an approach:

http://cxf.apache.org/faq.html#FAQ-HowcanIturnonschemavalidationforjaxwsendpoint%3F

like image 1
Biju Kunjummen Avatar answered Oct 23 '22 03:10

Biju Kunjummen