Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Spring Web Services handler

Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All:

I am using Rad 7, Websphere 6.1.
I used the rpc GenericHandler in Rad7 and it works. But I want to implement a version in Spring or Spring Web Services
Here are the contents of my webservices.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE webservices PUBLIC "-//IBM Corporation, Inc.//DTD J2EE Web services 1.0//EN" "">

<webservices id="WebServices_1066491732483">
<webservice-description id="WebServiceDescription_1066491732483">
<port-component id="PortComponent_1066491732483">
<wsdl-port id="WSDLPort_1066491732483">
<service-impl-bean id="ServiceImplBean_1066491732483">
<handler id="Handler_1066493401322">

Here are my GenericHandler implementation code:
* Created on Oct 18, 2003
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
package handler;

import java.util.Date;

import javax.xml.namespace.QName;
import javax.xml.rpc.handler.GenericHandler;
import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;

* @author Andre Tost
public class PerformanceHandler extends GenericHandler {

protected HandlerInfo info = null;
protected Logger logger = null;

public boolean handleRequest(MessageContext context) {
try {
Date startTime = new Date();
context.setProperty("startTime", startTime);
} catch (Exception x) {
// insert error handling here
return true;

public boolean handleResponse(MessageContext context) {
try {
Date startTime = (Date)context.getProperty("startTime");
Date endTime = new Date();
long elapsedTime = endTime.getTime()-startTime.getTime();
logger.write("Elapsed time is "+elapsedTime+"\n");
} catch (Exception x) {
// insert error handling here
return true;

/* (non-Javadoc)
* @see javax.xml.rpc.handler.Handler#getHeaders()
public QName[] getHeaders() {
return info.getHeaders();

public void init(HandlerInfo arg) {
info = arg;
logger = Logger.getLogger("c://temp//HelloWorldServiceLog");

public void destroy() {

Does anybody know how I can implement the handler like GenericHandler with Spring or Spring Web Services.
Any suggestions are appreciated it.


Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Were you able to get this to work? The obvious issue is <jaxrpc-mapping-file> doesn't make sense when trying to get spring-ws to work.
If you look closely at this tiny ad, you will see five bicycles and a naked woman:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic