sheetal sharma

+ Follow
since Nov 06, 2008
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sheetal sharma

Hi All,

I have a java program that sends XML file as a SOAP request using proxy and in turns retrieves an XML response from a server. I am using java6 to compile and run this program and it works fine.

Now I intend to make this as a web service using Axis2 version 1.4.1 and as a first step I included Axis2 libraries to my projects classpath in eclipse 3.3. Now I again ran the same program and it failed. Here is the stack trace.


Exception in thread "main" javax.xml.soap.SOAPException:

at org.apache.axis2.saaj.SOAPConnectionImpl.handleSOAPMessage(


at ActivityWebService.SendSoapMessage(

at ActivityWebService.main(

Caused by: org.apache.axis2.AxisFault:

at org.apache.axis2.AxisFault.makeFault(

at org.apache.axis2.transport.http.HTTPSender.sendViaPost(

at org.apache.axis2.transport.http.HTTPSender.send(

at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(

at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(

at org.apache.axis2.engine.AxisEngine.send(

at org.apache.axis2.description.OutInAxisOperationClient.send(

at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(

at org.apache.axis2.client.OperationClient.execute(

at org.apache.axis2.saaj.SOAPConnectionImpl.handleSOAPMessage(

... 3 more

Caused by:

at Source)

at Source)

at Source)

at Source)

at<init>(Unknown Source)

at Source)

at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(

at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1.doit(

at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$

at Source)


On further investigation I found that this is being caused by axis2-saaj-1.4.1.jar as it conflicts with Java6. If I remove axis2-saaj-1.4.1.jar from my classpath I am able to run the same program.

Is my analysis valid? If so, Is it okay to use java's SAAJ api instead of Axis2's SAAJ api? Do you see any issues in this in longer run?

The exception is thrown at this code line

SOAPMessage response =, endpoint);

Here is few code snippets from my program.

// Setting up proxies




// Getting inputs from command line and Authenticating.

String SOAPUrl = args[0];

String xmlFile2Send = args[1];

final String authUser = args[2];

final String authPassword = args[3];


new Authenticator() {

public PasswordAuthentication getPasswordAuthentication() {

return new PasswordAuthentication(

authUser, authPassword.toCharArray());




System.+setProperty+("http.proxyUser", authUser);

System.+setProperty+("http.proxyPassword", authPassword);

// Sending XML and processing response

private static void SendSoapMessage(String SOAPURL, String SOAPAction, String sXML) throws Exception



SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.+newInstance+();

SOAPConnection SOAPConn = soapConnectionFactory.createConnection();

MessageFactory factory = MessageFactory.+newInstance+();

SOAPMessage message = factory.createMessage();

MimeHeaders headers = message.getMimeHeaders();

// SOAP11

headers.addHeader("SOAPAction", "\"" + SOAPAction + "\"");

SOAPPart soapPart = message.getSOAPPart();

StringReader srXml = new StringReader(sXML);

StreamSource ssXML = new StreamSource (srXml);




// call the SOAP service

URL endpoint = new URL(SOAPURL);

SOAPMessage response =, endpoint);


// Debug - Can remove this line

response.writeTo(+fos+); // DEBUG

// extract body from the response

SOAPBody soapBody = response.getSOAPBody();

// check for SOAP fault

if (soapBody.hasFault())

throw new Exception("SOAP Fault - " +


// extract the Result tag element

NodeList lstResult = soapBody.getElementsByTagName("TagNameTest");

SOAPElement elResult = (SOAPElement)lstResult.item(0);

String sResult = elResult.getValue();

System.out.println("Result: " + sResult);


Appreciate your help and guidance.


15 years ago