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
AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (0)null faultActor: faultNode: faultDetail: {}:return code: 0 {http://xml.apache.org/axis/}HttpErrorCode:0 (0)null 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"/> ... </deployment>
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.
AXIS is a very good Framework to create WebService and use Objects to send and get Data. Here i have 2 examples obout this:
http://frameworksjava2008.blogspot.com/search/label/AXIS1
http://frameworksjava2008.blogspot.com/search/label/AXIS2
See you …
http://viviendoconjavaynomoririntentandolo.blogspot.com
http://frameworksjava2008.blogspot.com
Thank you very much!
You save my life today! I used the second solution and it works fine!
Nice one Felipe, I am glad I was of help.
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”
?
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
hi!
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!?
Hello Richard, try to turn off the chuncked encoding by supplying a false argument to the following property
org.apache.axis2.transport.http.HTTPConstants.CHUNKED
For more information have a look here: http://wso2.org/library/209
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…
Hello Richard, I am facing the same problem with axis 1.4, any luck solving this one? Thanks in advance.
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
super(getProvider());
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
Sreekanth
Hello Sreekanth, what lines throws the error?
dude !! u turned out my day!! Kudos!!
You great, you saved my ass !
I did the 1st solution and it works fine.
Thank you for this post. Saved me from wasting a lot of time.
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.
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.
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! 🙂
Matt
Hello Matt, never saw this before.It probably has to do with the specific iSeries implementation.
Kind of you to reply, thanks all the same. Back to head scratching.
Hi,
I’m getting a error javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure with Axis..
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
faultActor:
faultNode:
faultDetail:
{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.
Gopi.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: error in msg parsing:
xml was empty, didn’t parse!
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:error in msg parsing:
xml was empty, didn’t parse!
Please help me