File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Configuring WebService Client Handle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Configuring WebService Client Handle" Watch "Configuring WebService Client Handle" New topic

Configuring WebService Client Handle

anubechara Gupta

Joined: Jul 05, 2006
Posts: 17
Hello Ranchers,
I am having problem while configuring Client side handler for webservice in Websphere. My handler is not working (not getting intialized) even after making required configuration.
I have following lines in my web.xml file:
<description>WSDL Service PartyService</description>
<service-qname xmlns fx="">pfx artyService</service-qname>
And my handler class is:
package com.handler;

import javax.xml.rpc.handler.Handler;
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPHeader;
import javax.xml.namespace.QName;

public class HeaderHandler implements Handler
public void init(javax.xml.rpc.handler.HandlerInfo config) {

public QName[] getHeaders ()
// Fill in method body
return null;

public boolean handleRequest( MessageContext context )
// Fill in method body or delete method to use GenericHandler
SOAPMessageContext smc = (SOAPMessageContext) context;
try {
SOAPEnvelope se = smc.getMessage().getSOAPPart().getEnvelope();
// create instance of SOAP factory
SOAPFactory sFactory = SOAPFactory.newInstance();
// create SOAP elements specifying prefix and URI
SOAPElement sHelem1 = sFactory.createElement("authHeader1","a0","www");
SOAPElement sCHelem11 = sFactory.createElement("id","a0","www");
// attach value to id element
SOAPElement sCHelem12 = sFactory.createElement("password","a0","www");

// attach value to password element
//add child elements to the root element

// create SOAPHeader instance for SOAP envelope
SOAPHeader sh = se.addHeader();
// add SOAP element for header to SOAP header object
} catch (SOAPException e) {
// TODO Auto-generated catch block
return true;

public boolean handleResponse( MessageContext context )
// Fill in method body or delete method to use GenericHandler
return true;

public boolean handleFault( MessageContext context )
// Fill in method body or delete method to use GenericHandler
return true;

/* (non-Javadoc)
* @see javax.xml.rpc.handler.Handler#destroy()
public void destroy() {
// TODO Auto-generated method stub



Help will be appreciated. Many Thanks in advance
Consider Paul's rocket mass heater.
subject: Configuring WebService Client Handle
It's not a secret anymore!