Home > axis, Web Services > Axis returned (0)null – a solution

Axis returned (0)null – a solution

This is a very weird error I was getting a few days ago when I was running Apache Axis. If you output the stack trace you will get the following error

faultCode: {http://xml.apache.org/axis/}HTTP
faultString: (0)null
{}:return code:  0


at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)

If you delve into the apache axis source code you will see that this is actually a network error. There is a variable that holds the network code. This variable is assigned to zero in the beginning of the axis class. At some point the developers of axis read the HTTP responses and assign the HTTP code to this network code variable. But along the flow of the class an exception occurs and this network code remains zero. The null you get next to it is the actual error message description which is null because the exception doesn’t assign a message to it (exactly like it happens with the zero).

This occurred to me when I tried to use a DIME attachment with axis. It seems that axis 1 (not sure about axis 2) does not support DIME attachments properly. In order to resolve this (and the error above) you will need to use another transport handler. There is a solution described in the Axis attachment problems page. Although the solution described in the link is for a different problem, the same solution can be applied for the (0)null issue.

As the page explains the solution is to change the client-config.wsdd file (from within the org\apache\axis\client) and assign a different handler to the file, like the following

<deployment name="defaultClientConfig" ...>
<transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender"/>

In order to do this you will need to extract all the classes in the axis.jar file, change the client-config.wsdd, and recreate the axis.jar file. You will also need to include the apache commons http client 3.1 and commons-codec 1.3 in your classpath.

The second solution, if you don’t want to recreate the axis.jar file, is to use an EngineConfiguration and pass the new handler to it programmatically.

EngineConfiguration engine = EngineConfigurationFactoryFinder.newFactory().getClientEngineConfig();
SimpleProvider provider = new SimpleProvider(engine);
provider.deployTransport("http", new CommonsHTTPSender());

Then you will need to pass this provider instance in your web service class that extends the org.apache.axis.client.Service. This can be done by passing it in the constructor of your service class.

Categories: axis, Web Services
  1. 14 November 2009 at 4:35 pm

    AXIS is a very good Framework to create WebService and use Objects to send and get Data. Here i have 2 examples obout this:


    See you …


  2. Felipe Sá
    18 January 2010 at 1:48 pm

    Thank you very much!

    You save my life today! I used the second solution and it works fine!

  3. 18 January 2010 at 6:10 pm

    Nice one Felipe, I am glad I was of help.

  4. Borges
    9 February 2010 at 12:47 pm

    You save my life too!!! 😉

    But, how supress the warning message ?
    org.apache.commons.httpclient.HttpMethodBase processCookieHeaders
    WARNING: Cookie rejected: “ORA_CONTENT_DAV=EXPIRED”. Illegal path attribute “/content/dav”. Path of origin: “/content/ws/RemoteLoginManager”


  5. 9 February 2010 at 1:32 pm

    Hello Borges, I am glad you got it solved.

    With regards to your question, I am afraid there isn’t an automatica way to do it, you will have to implement your own CookiePolicy. The cookie that is accessed is invalid, and the HttpClient does not allow it. Several web browser migth allow it because they don’t fully implement the standards, while the Httpclient does.

    If you need more info have a look here: http://www.mail-archive.com/httpclient-user@jakarta.apache.org/msg03046.html

  6. richard
    23 March 2010 at 10:37 pm

    i’m building a java client to administrate a magento webstore.
    i ran into a related problem: i get exactly the same fault + stack trace, but in my case it does not seem to be related to DIME attachments. the best part is that the fault occurs randomly… furthermore, when i try your solution i get a “(411)Length Required” axis fault (caused by “chunked Transfer-Encoding forbidden”).
    any ideas!?

    • 24 March 2010 at 7:40 am

      Hello Richard, try to turn off the chuncked encoding by supplying a false argument to the following property


      For more information have a look here: http://wso2.org/library/209

      • richard
        24 March 2010 at 8:53 pm

        i finally got your solution to run using:
        .getEngine().setOption(MessageContext.HTTP_TRANSPORT_VERSION, HTTPConstants.HEADER_PROTOCOL_V10);
        (in case anyone is having the same problem with axis 1.4)
        unfortunately this didn’t solve my issues… i think it is a server side issue related to timeouts. going to investigate this…

  7. Michael Massry
    18 May 2010 at 4:00 pm

    Hello Richard, I am facing the same problem with axis 1.4, any luck solving this one? Thanks in advance.

  8. Sreekanth
    8 September 2010 at 12:02 pm

    I am receiving fault exception that says when i try the second method by passing engine configuration programatically:
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1

    private static EngineConfiguration getProvider()
    EngineConfiguration engine = EngineConfigurationFactoryFinder.newFactory().getClientEngineConfig();
    SimpleProvider provider = new SimpleProvider(engine);
    provider.deployTransport(“http”, new CommonsHTTPSender());
    return provider;

    //statement in constructor of class that extends org.apache.axis.client.Service

    I do have following libraries in my class path: apache commons http client 3.1 and commons-codec 1.3

    Can you help?

    Thank you

    • 8 September 2010 at 12:16 pm

      Hello Sreekanth, what lines throws the error?

  9. shiva
    1 March 2011 at 8:11 am

    dude !! u turned out my day!! Kudos!!

  10. marco
    8 September 2011 at 9:47 am

    You great, you saved my ass !
    I did the 1st solution and it works fine.

  11. Anju
    19 October 2011 at 1:11 am

    Thank you for this post. Saved me from wasting a lot of time.

  12. Rajesh T
    1 April 2013 at 11:14 am

    Thanks for solution provided. I have a question regarding editing file client-config.wsdd. It has already got the below line

    As modification also includes transport name as http, should HTTPSender be deleted or can it be there along with CommonsHTTPSender. I tried deleting old value, but it doesnot solve the problem. But keeping both actually, solved the problem in per-production machine.

    I need to test the same in production based on your advise.

    • 1 April 2013 at 7:57 pm

      I am not sure actually, I think you can only keep one but your example proves me wrong. Maybe it tries to find the one and if it doesn’t it goes to the second one and so on. If it works I’d say leave it as it is.

  13. Matt
    18 April 2013 at 12:35 pm

    Hi Panos,

    I’m experiencing the same error with Axis 1.4 but only on one customer’s iSeries and only when I attempt to connect using HTTPS. If I change the endpoint to use HTTP it works fine. Other iSeries implementations work fine. Is this something you’ve come across before, or can you offer any clues?

    Thanks in advance! 🙂

    • 19 April 2013 at 5:22 pm

      Hello Matt, never saw this before.It probably has to do with the specific iSeries implementation.

      • Matt
        19 April 2013 at 5:38 pm

        Kind of you to reply, thanks all the same. Back to head scratching.

  14. Gopi
    18 March 2014 at 9:33 am

    I’m getting a error javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure with Axis..

    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultString: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    {http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at com.ibm.jsse2.n.a(n.java:42)
    at com.ibm.jsse2.n.a(n.java:43)
    at com.ibm.jsse2.pc.b(pc.java:569)
    at com.ibm.jsse2.pc.a(pc.java:506)
    at com.ibm.jsse2.pc.a(pc.java:416)
    at com.ibm.jsse2.e.read(e.java:13)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:229)

    Would appreciate any help in this regard.


  15. 14 April 2016 at 4:06 am

    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
    faultString: error in msg parsing:
    xml was empty, didn’t parse!
    {http://xml.apache.org/axis/}stackTrace:error in msg parsing:
    xml was empty, didn’t parse!

    Please help me

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: