Logging SOAP message on http gateway spring integration -
i using spring integration (4.0.6) make soap calls rest service using int-http:outbound-gateway , int-ws:outbound-gateway. there way log soap request message in case of exception.
<int:gateway id="mygateway" service-interface="myservice"> <int:method name="getdata" request-channel="reqchannel" reply-channel="repchannel"> </int-gateway>
my outbound-gateway configured below
<int-http:outbound-gateway id="og1" request-channel="reqchannel" url="xxx" http-method="post" reply-channel="repchannel" reply-timeout="10000" message-converters="converter" request-factory="reqfactory"> <bean id="reqfactory" class="org.springframework.http.client.simpleclienthttprequestfactory"> <property name="ctimeout" value="20000"/> <property name="rtimeout" value="20000"/> </bean>
ok, try method. create own error handler implements spring error handler interface. in context file
<bean id="soaperrorhandlingsynctaskexecutor" class="org.springframework.integration.util.errorhandlingtaskexecutor"> <constructor-arg> <bean class="org.springframework.core.task.synctaskexecutor" /> </constructor-arg> <constructor-arg> <bean class="errorhandle" p:errorsender-ref="errorsender"/> </constructor-arg> </bean> <bean id="errorsender" class="org.springframework.integration.core.messagingtemplate" p:defaultchannel-ref="errors" />
when ever ws adapter throws exception org.springframework.integration.util.errorhandlingtaskexecutor catches exception upto how handle exception in error handler.
the soap faultcode , faultstring found in messagingexception's cause (if soapfaultclientexception).
here sending error messages channel me monitor.
hope helps.
Comments
Post a Comment