Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

AxisFault: The input stream for an incoming message is null

Posted on 2014-01-07
11
Medium Priority
?
4,993 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
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
 

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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

715 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