Solved

AxisFault: The input stream for an incoming message is null

Posted on 2014-01-07
11
4,238 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 53
How to parse custom JSON to POJO java 4 73
stackato and cloud 4 85
difference of if loops 23 49
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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 learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…

773 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