Solved

AxisFault: The input stream for an incoming message is null

Posted on 2014-01-07
11
3,874 Views
Last Modified: 2014-01-16
I am getting this error message:

Exception in thread "main" org.apache.axis2.AxisFault: The input stream for an incoming message is null.
      at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:92)
      at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
      at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
      at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
      at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
      at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
      at demo.com.TestProxyStub.sayHello(TestProxyStub.java:190)
      at demo.com.Test.main(Test.java:40)



Source Code  attached.


Can you please tell how do I fix it ?
Test.txt
0
Comment
Question by:cofactor
  • 8
  • 3
11 Comments
 

Author Comment

by:cofactor
ID: 39761895
comments please.
0
 

Author Comment

by:cofactor
ID: 39763010
comments please.
0
 

Author Comment

by:cofactor
ID: 39764514
any thoughts ?
0
 
LVL 35

Expert Comment

by:girionis
ID: 39764633
In your options, try to set the following:

o.setProperty(Constants.Configuration.MESSAGE_TYPE,HTTPConstants.MEDIA_TYPE_APPLICATION_ECHO_XML);
o.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE);

Open in new window

0
 

Author Comment

by:cofactor
ID: 39765179
Hi girionis,

I tried the same but it did not work.

Here is the code and error message

package demo.com;

import java.rmi.RemoteException;


import org.apache.axis2.Constants;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HTTPConstants;

public class Test {

	/**
	 * @param args
	 * @throws RemoteException
	 */
	public static void main(String[] args) throws RemoteException {
		// TODO Auto-generated method stub

		TestProxyStub tsb = new TestProxyStub();
		ServiceClient client = tsb._getServiceClient();
          
        Options o = client.getOptions();
		o.setPassword("admin");
        o.setUserName("admin");
        
       
        
        
        o.setProperty(Constants.Configuration.MESSAGE_TYPE,HTTPConstants.MEDIA_TYPE_APPLICATION_ECHO_XML);
        o.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE);
        
        client.setOptions(o); 
        
        System.setProperty("javax.net.ssl.trustStore", "C:/wso2esb-4.7.0/repository/resources/security/wso2carbon.jks");
        System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
       

		SayHello sh = new SayHello();
		sh.setName("Demo");
		SayHelloResponse shr = tsb.sayHello(sh);
		System.out.println(shr.get_return());

	}

}







Error:
------------------

Exception in thread "main" org.apache.axis2.AxisFault: The input stream for an incoming message is null.
	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:92)
	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
	at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
	at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
	at demo.com.TestProxyStub.sayHello(TestProxyStub.java:190)
	at demo.com.Test.main(Test.java:41)

Open in new window

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:cofactor
ID: 39765344
any thoughts ?
0
 
LVL 35

Expert Comment

by:girionis
ID: 39767582
Add all the properties, the ones you have and the new ones

o.setPassword("admin");
o.setUserName("admin");
o.setProperty(HTTPConstants.CHUNKED,Constants.VALUE_TRUE);
o.setProperty(Constants.Configuration.MESSAGE_TYPE,HTTPConstants.MEDIA_TYPE_APPLICATION_ECHO_XML);
o.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE);        

Open in new window

0
 

Author Comment

by:cofactor
ID: 39767829
Ok.  did that....but still same error is coming.

is there anything else to try ?

Here is the code:

import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axis2.Constants;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.Parameter;

import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyEngine;


public class Test {

	/**
	 * @param args
	 * @throws RemoteException
	 */
	public static void main(String[] args) throws RemoteException {
		// TODO Auto-generated method stub

		TestProxyStub tsb = new TestProxyStub();
		ServiceClient client = tsb._getServiceClient();
          
        Options o = client.getOptions();
		
       
        
              
        o.setPassword("admin");
        o.setUserName("admin");
        o.setProperty(HTTPConstants.CHUNKED,Constants.VALUE_TRUE);
        o.setProperty(Constants.Configuration.MESSAGE_TYPE,HTTPConstants.MEDIA_TYPE_APPLICATION_ECHO_XML);
        o.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE); 
        
       
        
        
        client.setOptions(o); 
        
        System.setProperty("javax.net.ssl.trustStore", "C:/wso2esb-4.7.0/repository/resources/security/wso2carbon.jks");
        System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
       

		SayHello sh = new SayHello();
		sh.setName("Demo");
		SayHelloResponse shr = tsb.sayHello(sh);
		System.out.println(shr.get_return());

	}
	
	
}

Open in new window



Error message:

log4j:WARN No appenders could be found for logger (org.apache.axis2.description.AxisService).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.axis2.AxisFault: The input stream for an incoming message is null.
      at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:92)
      at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
      at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
      at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
      at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
      at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
      at demo.com.TestProxyStub.sayHello(TestProxyStub.java:190)
      at demo.com.Test.main(Test.java:67)
0
 
LVL 35

Expert Comment

by:girionis
ID: 39767845
It probably has to do with the SSL. Can you post the axis2.xml file?
0
 

Accepted Solution

by:
cofactor earned 0 total points
ID: 39774359
Issue resolved.  for benefit others I post some snippet here.

you need  to configure rampartconfig

 RampartConfig rampartConfig = new RampartConfig();
 rampartConfig.setUser("admin");

  // write a handler class  and attach to rampartconfig

  Policy policy = new Policy();
  policy.addAssertion(rampartConfig);

 client.getAxisService().getPolicyInclude().addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY, policy);
           
  System.setProperty("javax.net.ssl.trustStore", "C:/Downloads/wso2esb-4.7.0/repository/resources/security/wso2carbon.jks");
            System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");


SayHello sh = new SayHello();
            sh.setName("Demo1");
            SayHelloResponse shr = tsb.sayHello(sh);
            System.out.println(shr.get_return());
0
 

Author Closing Comment

by:cofactor
ID: 39784878
solved issue myself
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
parentbit challenge 3 52
wordlen challenge 3 46
API Soap Calls 4 58
Java Server Faces parameter pass? 6 20
When coding a Webservice to provide data, the normal way is to create a method that returns a Dataset object.   But a Dataset cannot be used easily from another platform, such as PHP,  FLAS (FLEX) , etc. Solution : Return a XML Document instea…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now