Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 463369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:10:06+00:00 2026-05-12T23:10:06+00:00

I’ve created an Extension of GenericHandler called SOAPHeaderHandler. I placed log4j statements in the

  • 0

I’ve created an Extension of GenericHandler called SOAPHeaderHandler. I placed log4j statements in the handler and can see the constructor being built. When I generate a SOAP message, however, I don’t see the message related to the handleRequest method. I’ve registered the Handler in the stub as follows:

if (service == null) {
    super.service = new com.ibm.ws.webservices.engine.client.Service();
}
else {
    super.service = service;
}
List handlerInfoList = new ArrayList();
QName[] headersArr = null;
HandlerInfo handlerInfo = new HandlerInfo(com.xxxxxx.hdhp.business.debitcard.cardservices.CardServiceSOAPHeaderHandler.class, 
     null, headersArr);
handlerInfoList.add(handlerInfo);
service.getHandlerRegistry().setHandlerChain(new QName("MetavanteDebitCard"), handlerInfoList);

The Handler is:

public class AccountManagementSOAPHeaderHandler extends GenericHandler {
 private static Logger logger = Logger.getLogger  (AccountManagementSOAPHeaderHandler.class);
 private HandlerInfo handlerInfo = null;

public AccountManagementSOAPHeaderHandler () {
 logger.info("Constructing AccountManagementSOAPHeaderHandler");
}

 /* (non-Javadoc)
  * @see javax.xml.rpc.handler.GenericHandler#getHeaders()
  */
 public QName[] getHeaders() {
 logger.info("calling getHeaders()");
  return null;
 }

 public boolean handleFault(MessageContext arg0) {
     logger.info("Fault in AccountManagementSOAPHeaderHandler");
  return true;
 }
 public boolean handleResponse(MessageContext arg0) {
   logger.info("Response in AccountManagementSOAPHeaderHandler");
   return true;
 }
 public void init(HandlerInfo arg0) {
  logger.info("init in AccountManagementSOAPHeaderHandler");
  handlerInfo = arg0;
  super.init(arg0);
 }

 public void destroy() {
  logger.info("--- In AccountManagementSOAPHeaderHandler.destroy ()");
 } 

 public boolean handleRequest(MessageContext ctx) {
     logger.debug("BEGIN handleRequest()");
     if (ctx instanceof SOAPMessageContext) {
        SOAPMessageContext context = (SOAPMessageContext) ctx;
        logger.debug("instance of SOAPMessageContext");
        try {
           SOAPHeader header = context.getMessage().getSOAPPart()
                .getEnvelope().getHeader();
           logger.debug("SOAP Header is " + ((header==null)?"NULL":"NOT NULL"));
           Iterator headers = header
                .extractHeaderElements("http://schemas.xmlsoap.org/soap/actor/next");
           while (headers.hasNext()) {
               SOAPHeaderElement he = (SOAPHeaderElement) headers.next();
               logger.info("HEADER Qn " + he.getElementName().getQualifiedName());
           }
       } catch (SOAPException x) {
           logger.error("SOAPException while handlingRequest for SOAP: '" + x.getMessage() + "'");
   }
  }
 return true;
}

and I’ve changed the web.xml as follows:

   <service-ref>
        <description>WSDL Service AccountManagerService</description>
        <service-ref-name>service/AccountManagerService</service-ref-name>
        <service-interface>com.medibank.www.AccountManagerService</service-interface>
<!--        <wsdl-file>WEB-INF/wsdl/AccountManagerService.asmx.wsdl</wsdl-file>-->
        <jaxrpc-mapping-file>WEB-INF/AccountManagerService.asmx_mapping.xml</jaxrpc-mapping-file>
        <service-qname xmlns:pfx="http://www.medibank.com/MBIWebServices/Access/Services/AccountManager/2004/06/">pfx:AccountManagerService</service-qname>
        <port-component-ref>
            <service-endpoint-interface>com.medibank.www.AccountManagerServiceSoap</service-endpoint-interface>
        </port-component-ref>
        <port-component-ref>
            <service-endpoint-interface>com.medibank.www.AccountManagerServiceSoap</service-endpoint-interface>
        </port-component-ref>
        <handler>
         <description>
         </description>
         <display-name></display-name>
         <handler-name>AccountManagementSOAPHeaderHandler</handler-name>
         <handler-class>com.xxxxx.hdhp.business.debitcard.accountmanagement.AccountManagementSOAPHeaderHandler</handler-class>
        </handler>
    </service-ref>

This is deployed on Websphere Application Server v6.0.2.35. Any ideas what the problem may be? Why do the logger statements in the handler never get executed? Have I failed to register the handler correctly? Do I need to specify which service methods get handled?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:10:07+00:00Added an answer on May 12, 2026 at 11:10 pm

    I wrote a few JAX-RPC SOAP clients that run on WAS 6.0, and require GenericHandlers that add a custom SOAP header to request messages. I also had the requirement of not using a service-ref (for ease-of-use reasons in the client codebase), so my client class sets up the handler in a programmatic way. This may not exactly apply to how your configuration works, but maybe something will be of use.

    I started with the client code generated by RAD 7.5’s WSDL2Java tool in Ant, but the “Web Service Client” wizard uses it as well. It created all the business objects, serializer/deserializers, locator and SOAP binding classes, etc, etc. I then created a custom GenericHandler similar to the one you have.

    Since I didn’t have a service-ref available, I couldn’t bind it to the client that way. So I used the following code in the client class itself, to programmatically add the handler:

    private AccountManager createAccountManagerStub() throws Exception {
        AccountManagerServiceLocator locator = new AccountManagerServiceLocator();
    
        // Set the JMS endpoint address
        AccountManagerSOAPBindingStub accountManagerStub = (AccountManagerSOAPBindingStub) locator
                .getAccountManagerSOAPPort(new URL(generateJMSEndpointAddress()));
    
        // Set the Client Handler
        HandlerRegistry registry = locator.getHandlerRegistry();
        List chain = registry
                .getHandlerChain((QName) locator.getPorts().next());
        HandlerInfo handlerInfo = new HandlerInfo();
        handlerInfo.setHandlerClass(AccountManagerClientHandler.class);
        chain.add(handlerInfo);
    
        return (AccountManager) accountManagerStub;
    }
    

    The object returned by that method is completely set up, and calling any of the client methods on that class work correctly. The AccountManagerClientHandler.handleRequest(MessageContext msgContext) method is invoked, the messageContext updated, and then the message is sent on its merry way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.