In questo articolo vedremo come poter intercettare le richieste di servizio per effettuare le operazioni prima e dopo l'esecuzione dell'endpoint.
Fondamentale l'interceptor ci permette di:
Nel nostro progetto applichiamo un logger delle richieste e delle risposte e un validatore, ottenendo una configurazione di questo tipo.
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
<property name="mappings">
<props>
<prop key="{http://www.example.org/schema}RicercaLibroRequest">ricercaLibroEndpoint</prop>
</props>
</property>
<property name="interceptors">
<list>
<ref bean="loggingInterceptor"/>
<ref bean="validatingInterceptor"/>
</list>
</property>
</bean>
<bean id="loggingInterceptor"
class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
<bean id="validatingInterceptor"
class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
<property name="schema" value="classpath:schema.xsd"/>
<property name="validateRequest" value="true"/>
<property name="validateResponse" value="true"/>
</bean>