Kros
Kros

Reputation: 848

Server Side Logging with Spring-WS

I have implemented a web services using JaxWS-Spring. I would like to log the XML being received. I have tried various attempts, among which to add the proper categories to my log4j.properties file and using interceptors. However I have always failed for one reason or another (logging seems to be ignored - adding interceptors to my application context gives other issues).

The following snippets from my project :

PS: I am using Spring 2.5.6

web.xml

 <servlet>
            <servlet-name>jaxws-servlet</servlet-name>
            <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>


    <!-- Mapping to redirect all requests from 'FaxWebService' to jaxws-servlet. -->
        <servlet-mapping>
            <servlet-name>jaxws-servlet</servlet-name>
            <url-pattern>/FaxWebService</url-pattern>
        </servlet-mapping>

applicationContext.xml

<!-- Bind the URL FaxWebService to our bean FaxWebService. -->
    <wss:binding url="/FaxWebService">
        <wss:service>
            <ws:service bean="#faxWebService"/>
        </wss:service>
    </wss:binding>

<!-- Bean responsible of taking care of the webservice. -->
    <bean id="faxWebService" class="com.connexo.icubeplus3.dispatcher.webservices.FaxWebService"
          scope="singleton">
        <property name="dummyMode" value="${fax.dummy.mode}"/>
    </bean>

Upvotes: 1

Views: 2269

Answers (2)

evandongen
evandongen

Reputation: 2065

I doubt this has anything to do with Spring WS to be honest.

If you want to log the incoming messages in Spring WS, you want to raise the logging level for org.springframework.ws.client.MessageTracing.sent and org.springframework.ws.client.MessageTracing.received to TRACE. For example, in log4j config:

<logger name="org.springframework.ws.client.MessageTracing.sent">
    <level value="TRACE" />
    <appender-ref ref="stdout" />
</logger>
<logger name="org.springframework.ws.client.MessageTracing.received">
    <level value="TRACE" />
    <appender-ref ref="stdout" />
</logger>

Upvotes: 1

rodrigoap
rodrigoap

Reputation: 7480

You will have to write a handler to log it. There are various examples in the web, like http://docs.oracle.com/cd/E13222_01/wls/docs103/webserv_adv_rpc/handlers.html

Upvotes: 0

Related Questions