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 3277964
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:25:42+00:00 2026-05-17T19:25:42+00:00

I am using the Axis API to access Axis HTTP server. The documentation of

  • 0

I am using the Axis API to access Axis HTTP server.
The documentation of the API can be found here.

I am using the following code to add handlers to the server. service is of type java.xml.rpc.Service

    HandlerRegistry registry = service.getHandlerRegistry();
    QName serviceName = new QName(url, "MyServiceClass");

    List<HandlerInfo> handlerChain = new ArrayList<HandlerInfo>();
    HandlerInfo handlerInfo = new HandlerInfo(MyHandler.class, null, null);
    handlerChain.add(handlerInfo);
    registry.setHandlerChain(serviceName, handlerChain);

I know that the service name is correct as I am getting the correct output in subsequent calls to the service object.

Somehow the handler is not being invoked. Here is the Handler class.
My intention is to add custom headers to the HTTP request before forwarding the request to the server.

import javax.xml.namespace.QName;
import org.apache.axis.AxisFault;
import org.apache.axis.MessageContext;
import org.apache.axis.handlers.BasicHandler;

public class MyHandler extends BasicHandler {

    @Override
    public void init() {
        System.out.println("init called");
        super.init();
        System.out.println("init called");
    }

    @Override
    public void cleanup() {
        super.cleanup();
        System.out.println("cleanup called");
    }

    @Override
    public void invoke(MessageContext mc) throws AxisFault {
        System.out.println("invoke called");
    }

    public QName[] getHeaders() {
        System.out.println("getHeaders");
        return new QName[1];
    }
}

What is wrong with the above code?

Is there any other way to modify HTTP Headers using Apache Axis API?

  • 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-17T19:25:43+00:00Added an answer on May 17, 2026 at 7:25 pm

    Okie. This should do the trick :

    1 – Create a wsdd file (say /tmp/test.wsdd) containing this :

    <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
     <handler name="test" type="java:axistest.TestHandler" />
     <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender">
       <requestFlow>
        <handler type="test"/>
       </requestFlow>
     </transport>
    </deployment>
    

    2 – Ensure all axis libs are in your class path and then run :

    java org.apache.axis.utils.Admin client /tmp/test.wsdd
    

    3 – Step 2 will generate a client-config.wsdd. Copy this to your project and ensure it will be in the class path when the project is run.

    4 – ALL webservice calls (via Http transport) will route via the TestHandler1 class

    Here is my TestHandler1 class (a slight modification of ur handler to access the MIME headers) :

    package axistest;
    
    import javax.xml.namespace.QName;
    import javax.xml.soap.MimeHeaders;
    import org.apache.axis.AxisFault;
    import org.apache.axis.MessageContext;
    import org.apache.axis.handlers.BasicHandler;
    
    public class TestHandler1 extends BasicHandler {
    
    @Override
    public void init() {
        System.out.println("init called");
        super.init();
        System.out.println("init called");
    }
    
    @Override
    public void cleanup() {
        super.cleanup();
        System.out.println("cleanup called");
    }
    
    @Override
    public void invoke(MessageContext mc) throws AxisFault {
        System.out.println("invoke called");
        System.out.println("=----------------------------------=");
        MimeHeaders mimeHeaders = mc.getMessage().getMimeHeaders();
        mimeHeaders.addHeader("X-Test", "Hello");
        System.out.println("Headers : \n " + mimeHeaders);
    }
    
    public QName[] getHeaders() {
        System.out.println("getHeaders");
        return new QName[1];
    }
    
    }
    

    when I run this on my box, I see that these handler methods are being invoked :

    - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
    init called
    init called
    invoke called
    =----------------------------------=
    Headers : 
     org.apache.axis.message.MimeHeaders@761eec35
    .
    .
    .
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using base graphics in R, how can I add superscripts to axis labels, as
How can one image be rotated with axis of rotation as image centre using
I am using Axis media parser SDK to get h264 stream, how can I
I have a web service client using axis. It's using document/literal style and supposed
I'm connecting to web service using Axis 1.4. This service signals error by responding
Currently I am using Axis for Restfull SOAP calls to Rally's Web Service, but
I just created a web service client using axis and eclipse that does not
How I can highlight a value in the x-axis using MS. Chart Controls? X-axis
I'm actually developing a Web Service in Java using Axis 2. I designed my
I can to connect to the liferay throw /api/secure/axis/ and i can to create

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.