You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by SM <mo...@yahoo.com> on 2010/03/30 23:59:17 UTC

Testing Axis2 and Secure web service using a java client - read timeout exception

Hello all,
  I have created a simple HelloWorld axis2 webservice and it works perfectly when rampart is not engaged.  I made the web service a secure one implementing transport level security as indicated by Nandana in the following tutorial:
 
http://wso2.org/library/3190
 
When I invoke the secure webservice from a client I get the following error:  
 
log4j:WARN No appenders could be found for logger (org.apache.axis2.deployment.FileSystemConfigurator).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.axis2.AxisFault: Read timed out
 at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
 at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:83)
 at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
 at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
 at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
 at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
 at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
 at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
 at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
 at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
 at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:542)
 at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
 at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
 at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
 at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)
 at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
 at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
 at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
 at helloworld.HelloWorldServiceStub.add(HelloWorldServiceStub.java:472)
 at helloworld.HelloWorldClient.main(HelloWorldClient.java:35)
Caused by: com.ctc.wstx.exc.WstxIOException: Read timed out
 at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
 at org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:168)
 at org.apache.axiom.om.impl.dom.NodeImpl.serializeAndConsume(NodeImpl.java:830)
 at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79)
 ... 19 more
Caused by: java.net.SocketTimeoutException: Read timed out
 at java.net.SocketInputStream.socketRead0(Native Method)
 at java.net.SocketInputStream.read(SocketInputStream.java:129)
 at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)
 at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:782)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1089)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:618)
 at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
 at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
 at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
 at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
 at org.apache.commons.httpclient.ChunkedOutputStream.flush(ChunkedOutputStream.java:191)
 at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:99)
 at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214)
 at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
 ... 22 more
Disconnected from the target VM, address: '127.0.0.1:3209', transport: 'socket'

Any tips on resolving this will be help ful.
 
The client code for my app is as follows:
 
public class HelloWorldClient {
    public static void main(String[] args) throws Exception {
    ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("C:\\Documents and Settings\\mxshah\\HelloWorld\\repo", null);
 HelloWorldServiceStub stub = new HelloWorldServiceStub(ctx,"https://localhost:8443/axis2/services/HelloWorldService");
 ServiceClient sc = stub._getServiceClient();
 sc.engageModule("rampart");
 Options options = sc.getOptions();
 options.setUserName("apache");
 options.setPassword("password");
        options.setTimeOutInMilliSeconds(120000);

  int a = 3;
  int b = 4;
  int result = stub.add(a, b);
  System.out.println(a + " + " + b + " = " + result);
    }
}

 
Thank you!
 
MS