Solved

AxisFault: The input stream for an incoming message is null

Posted on 2014-01-07
11
4,746 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
When ransomware hits your clients, what do you do?

MSPs: Endpoint security isn’t enough to prevent ransomware.
As the impact and severity of crypto ransomware attacks has grown, Webroot has fought back, not just by building a next-gen endpoint solution capable of preventing ransomware attacks but also by being a thought leader.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

627 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